【问题标题】:add new pane in kendo ui splitter在 kendo ui 拆分器中添加新窗格
【发布时间】:2014-01-03 03:33:49
【问题描述】:
A 想动态地向 kendo ui 拆分器添加新窗格,但它似乎不起作用。
即使在他们的网站上也不起作用:Kendo ui splitter demo(我说的是追加窗格和插入窗格)
是否有可能他们添加了一些不起作用的演示,或者我错过了什么?
【问题讨论】:
标签:
javascript
kendo-ui
kendo-ui-splitter
【解决方案1】:
这是一个错误 - 显然,代码没有调用 _resize 方法(据我所知,在 _addPane 和 remove 中)。
不过似乎很容易解决(在首次创建拆分器之前将此代码添加到某处):
kendo.ui.Splitter.fn._addPane = function (config, idx, paneElement) {
var that = this;
if (paneElement.length) {
that.options.panes.splice(idx, 0, config);
that._initPane(paneElement, config);
that._removeSplitBars();
that.trigger("resize");
that._resize();
}
return paneElement;
};
kendo.ui.Splitter.fn.remove = function (pane) {
pane = $(pane);
var that = this;
if (pane.length) {
kendo.destroy(pane);
pane.each(function (idx, element) {
that.options.panes.splice($(element).index(".k-pane"), 1);
$(element).remove();
});
that._removeSplitBars();
if (that.options.panes.length) {
that.trigger("resize");
that._resize();
}
}
return that;
}
See demo