单击按钮时如何将单独的kendo窗口内容加载到html中

时间:2016-03-28 18:47:33

标签: jquery html kendo-ui kendo-window kendo-tabstrip

我正在尝试通过单击按钮将单独的html中的kendo tabstrip加载到kendo窗口中。我已经能够获得按钮,当单击时,将内容从单独的文件加载到窗口中,但不是像我应该的那样得到标签,我已经加载了所有内容。我可以获得标签的唯一方法是,如果我在一个index.html中拥有所有代码,但我需要将它们分开。这已经存在了几天的问题,我似乎无法找到解决方案。请帮忙。

在我的index.html中,我有:

<button class="submit-button" data-toggle="modal" data-target="modal" id="open-button" type="submit">Create New</button>

<div id="window"></div>

这是我的modal.html:

<div class="tab k-content" id="tabstrip-left">
  <ul>
    <li class="k-state-active">General Details</li>
    <li>Coverage Details</li>
    <li>Header &amp; Video</li>
    <li>CTA Buttons</li>
    <li>Savings Grid</li>
    <li>Footer</li>
  </ul>
  <div class="container-fluid">General Content</div>
  <div class="container-fluid">Coverage Content</div>
  <div class="container-fluid">Header & Video Content</div>
  <div class="container-fluid">CTA Content</div>
  <div class="container-fluid">Savings Content</div>
  <div class="container-fluid">Footer Content</div>
  <fieldset class="form-group">
    <ul class="pager wizard">
        <li class="save button">Save</li> 
        <li><button class="close-button">Close</button></li>
        <li class="back button">Back</li> 
        <li class="next button">Next</li>
        <li class="finish button">Finish</li>
    </ul>
  </fieldset>
</div>

和我的script.js

$(document).ready(function() {

$("#window").load("create.html");

//populate grid with internal data
var grid = $("#grid").kendoGrid({
            scrollable: true,
            dataSource: clients
        });

//variables
var myWindow = $("#window"),
    openButton = $("#open-button"),
    tabstripLeft = $("#tabstrip-left");
    closeButton = $(".close-button");

//'create new' opens up modal
openButton.click(function() {
    myWindow.data("kendoWindow")
    .center()
    .open();
});

//modal window settings
myWindow.kendoWindow({
    width: "900",
    title: "Website Content",
    visible: false,
    modal: true,
    actions: ["Close"],
}).data("kendoWindow");

//remove keyboard navigation
myWindow.removeAttr("tabindex");

//modal tabs 
tabstripLeft.kendoTabStrip({
    tabPosition: "left",
    animation: false,
    navigatable: true
});

//close modal button inside window
closeButton.click(function() {
    myWindow.data("kendoWindow").close();
    });
});

1 个答案:

答案 0 :(得分:1)

当您尝试初始化窗口小部件时,tabstrip html尚未呈现。尝试在create.html html中启动tabstrip小部件。