【问题标题】:Dynamically Inserted Kendo tabStrip tab not loading a content div动态插入的剑道 tabStrip 选项卡未加载内容 div
【发布时间】:2013-10-10 11:08:41
【问题描述】:

我正在尝试在 Kendo 中创建一个“添加选项卡”选项卡,该选项卡将添加到在选择下拉列表时创建的 tabStrip。使用 Ajax 加载的初始数据显示正常,但用户添加的选项卡却没有。

它应该在 tabStrip 中的自身之前插入一个选项卡(它确实如此),但是当我尝试初始化它包含的 Kendo 编辑器时,我得到一个“未定义”错误 - 这是因为相关的内容元素应该包含我的编辑器没有与新标签一起创建。

这是选择下拉列表时发生的情况:

$('#questionEditor').remove();                                                 //Remove and create the question editor tabs
                $('body').append('<div id="questionEditor"></div>');
                $('#questionEditor').kendoTabStrip();

                var tabStrip = $('#questionEditor').data('kendoTabStrip');

                var count = 0;                                                                //Count the amount of tabs
                for (var i = 0 ; i < returndata.questions.length; i++) {
                    var editor = '<div id="questionText' + i + '"></div>';

                    tabStrip.append([{ text: "Question " + (i + 1), content: editor }]);

                    var textEditor = '#questionText' + i;
                    $(textEditor).kendoEditor();
                    $(textEditor).data('kendoEditor').value(returndata.questions[i].QuestionText);

                    count++;
                }

                tabStrip.append([{ text: "Add Question", spriteCssClass: "k-add k-icon" }]);
                var lastChild = tabStrip.tabGroup[0].lastChild;
                $(lastChild).click(function () {                                                                        //New tab
                    var editor = '<div id="questionText' + count + '"></div>';
                    tabStrip.insertBefore([{ text: "Question " + (count + 1), content: editor }], $(lastChild));

                    var textEditor = '#questionText' + count;
                    $(textEditor).kendoEditor();
                    count++;
                });

但新标签在点击时不显示任何内容。在 jQuery ajax 对象中是否有某种剑道东西不起作用?

【问题讨论】:

    标签: javascript jquery asp.net-mvc tabs kendo-ui


    【解决方案1】:

    这是一种 hacky 解决方案,但问题是我的“添加新标签”标签没有 contentHolder - 所以我在初始化时向它添加了一个内容属性,然后将其禁用。

    【讨论】:

      猜你喜欢
      • 2019-06-21
      • 1970-01-01
      • 2013-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 1970-01-01
      相关资源
      最近更新 更多