jqueryhtmlkendo-uikendo-windowkendo-tabstrip

how to load separate kendo window content into html when button is clicked


I am trying to load a kendo tabstrip from a separate html into a kendo window with a click of a button. I've been able to get the button, when clicked, load up the content from a separate file into the window but instead of getting tabs, like i am supposed to, I have all the contents loaded out. The only way I can get tabs to work is if I have all the code in one index.html but I need to have them separated. This has been a problem for a couple of days now and I can't seem to find a solution. Please help.

Inside my index.html, I have:

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

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

and here is my 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>

and my 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();
    });
});

Solution

  • When you try to init the widget, the tabstrip html isn't rendered yet. Try initiating the tabstrip widget in the create.html html.