选项卡模板:
<div id="parentTabStrip">
<ul>
<li class="k-state-active">Titles</li>
<li>Commercials</li>
</ul>
<div id="titlesGrid"></div>
<div id="commercialsGrid"></div>
</div>
我不能简单地这样做$('#titlesGrid').data('kendoGrid');
,因为在标签和网格被实例化后,HTML 不是这样的。
这就是我现在正在做的事情:
<script type="text/javascript">
//on page load, the grid is built.
var year = $("#txtYear").val();
createTitlesGrid(year);
$("#txtYear").on("change", function()
{
//on the click of a button, I do the following...
//get the tabStrip (this works)
var tabStrip = $('#parentTabStrip').data("kendoTabStrip");
//now I need to reference the actual grid. The thing is, I don't know how to find it through the tab (this does not work).
var grid = tabStrip.select("titlesGrid");
//once I have the grid, I then need to destroy it.
grid.destroy();
//finally, I get the value entered by the user in the text box and build the grid again.
var year = this.value;
createTitlesGrid(year);
});
</script>
任何人都可以帮我解决这个问题。在剑道中有一种特定的方法来引用对象,我很难做到这一点。
同样,我需要做的是引用选项卡内的剑道网格,以便我可以销毁它。