在kendo ui splitter中添加新窗格

时间:2014-01-02 14:04:42

标签: javascript kendo-ui kendo-ui-splitter

想要动态地向kendo ui spliter添加新窗格,但它似乎无法正常工作。 即使在他们的网站上它也不起作用:Kendo ui splitter demo(我在谈论附加窗格和插入窗格)

他们是否可能添加了一些不起作用的演示,或者我错过了什么?

1 个答案:

答案 0 :(得分:1)

这是一个错误 - 显然,代码并没有调用_resize方法(在_addPaneremove中,据我所知)。

虽然似乎是一个简单的修复(在您第一次创建拆分器之前在某处添加此代码):

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

相关问题