【问题标题】:Toggle Kendo Splitter on button click inside iframe在 iframe 内单击按钮时切换 Kendo Splitter
【发布时间】:2015-07-29 08:15:33
【问题描述】:

我的剑道分割器如下。

@(Html.Kendo().Splitter()
      .HtmlAttributes(new { style = "height:590px;", id = "mainSplitter" })
      .Orientation(SplitterOrientation.Horizontal)
      .Panes(horizontalPanes =>
      {
          horizontalPanes.Add()
              .HtmlAttributes(new { id = "left-pane" })
              .Size("246px")
              .Collapsible(true)
              .Content(@<text></text>);
          horizontalPanes.Add()
              .HtmlAttributes(new { id = "right-pane", style = "overflow:hidden;" })
            .Content(@<iframe id="tabsContent_iframe" src='' data-src='' style="width:100%;height:100%;"></iframe>
            );
      })
)

在我的 POC 中,我在拆分器外有一个按钮,用于切换 left-pane,效果很好。

现在,如果我在 iframe 中使用相同的按钮并拨打电话。它不起作用。

我尝试了以下几种方式:

1)

 var parentSplitterId = parent.$('#mainSplitter').data("kendoSplitter");
  var parentLeftTogglePane = parent.$('#full-pane');// , window.parent.document);
    parentSplitterId[parentLeftTogglePane.width() > 0 ? "collaspe" : "expand"](parentLeftTogglePane);

2)

 var parentSplitterId = window.parent.document.getElementById('mainSplitter');
var parentLeftTogglePane = $('#full-pane', window.parent.document);
var splitter = $("#parentSplitterId").data("kendoSplitter");
splitter[leftTogglePane.width() > 0 ? "collaspe" : "expand"](leftTooglePane);

我无法理解我哪里出错或我错过了什么。请在这里指导我。

谢谢

【问题讨论】:

  • 在您尝试的代码中,parentSplitterId 变量是否获得了它的值?
  • 是的。我能够获得parentSplitterId 的实例。但最后一行是我得到这个错误的地方:parentSplitterId[(intermediate value)(intermediate value)(intermediate value)] is not a function
  • 你拼错了collapse,是吗?
  • 哇!万分感谢 。不敢相信我已经为此工作了好几天:/

标签: javascript jquery asp.net-mvc iframe kendo-splitter


【解决方案1】:

解决方法很简单,因为您拼错了 collapse,而是写成了 collaspe。

【讨论】:

    猜你喜欢
    • 2015-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-14
    • 1970-01-01
    • 1970-01-01
    • 2015-02-28
    相关资源
    最近更新 更多