这是我绕过用于加载内容的内置选项卡机制的解决方案:http: //dojo.telerik.com/omOre
选项卡定义中的空内容 url:
jQuery(function(){jQuery("#tabstrip").kendoTabStrip({"select":onselect,"activate":onactivate,"contentLoad":onContentLoad,"animation":false,"contentUrls":["","","",""]});});
//Track our content
var tabcontent = [{"contentloaded":true},{"url":"http://demos.telerik.com/kendo-ui/content/web/tabstrip/ajax/ajaxContent1.html"},{"url":"http://demos.telerik.com/kendo-ui/content/web/tabstrip/ajax/ajaxContent2.html"},{"url":"http://demos.telerik.com/kendo-ui/content/web/tabstrip/ajax/ajaxContent3.html"} ];
实现“选择”事件 - 确定我们是否应该通过 AJAX 加载选项卡(发布) - 跟踪选项卡是否已加载
//When selected, if ajax and not not loaded - load the content
function onselect(e) {
console.log("select");
var index = $(e.item).index();
var taburl = tabcontent[index].url;
var contentloaded = tabcontent[index].contentloaded;
if(taburl !== "" && contentloaded !== true)
{
//get reference to the TabStrip widget
var ts = $("#tabstrip").data("kendoTabStrip");
//get the tab content
var item = ts.contentElement(index);
$.ajax({
type: "get",//simple change! "post",
url: taburl,
success: function (response) {
$(item).html(response);
tabcontent[index].contentloaded = true;
console.log("Tab Index: " + index + ", Url: " + taburl + " [[ajax success]]");
}
});
}
}