[英]Jtable only displays when stepping through debugger
Hi I am struggling to display my jtable. 嗨,我在努力展示我的jtable。 It only displays when I step through the javascript with the debugger.
它仅在我使用调试器逐步浏览javascript时显示。
$("body").on("click", "#tabRole", function () {
document.getElementById("1").className = "inactive";
document.getElementById("2").className = "active";
$('#Admin-details').load('../Admin/ADRoleAdmin');
jTableRoles();
});
This method loads ADRoleAdmin as a partial view into a div. 此方法将ADRoleAdmin作为局部视图加载到div中。 Then jTableRoles() should load the jtable into a div (jTableRoles) inside ADRoleAdmin:
然后,jTableRoles()应该将jtable加载到ADRoleAdmin内的div(jTableRoles)中:
var jTableRoles = function () {
$(function () {
debugger;
$('#jTableRoles').jtable({
paging: true,
pageSize: 20,
sorting: true,
title: 'Roles',
onRowEdit: function (event, data) {
UpdateRoleDetails(data.records.RoleId, data.records.RoleName);
},
actions: {
listAction: '../Admin/GetRoles',
updateAction: 'dummy'
},
toolbar: {
items: [{
icon: '../Content/images/Misc/Add icon.png',
text: 'Create New',
click: function () {
UpdateRoleDetails(0, '');
}
}]
},
fields: {
Id: {
key: true,
list: false
},
Name: {
title: 'Role name',
},
Description: {
title: 'Role description',
sorting: false
}
}
});
$('#jTableRoles').jtable('load');
});
}
Please tell me what I am doing wrong or what I can do different to make it work. 请告诉我我做错了什么,或者我可以做些什么才能使其正常工作。
Looping through the steps takes extra time. 循环执行这些步骤需要花费额外的时间。 It looks like the load of ADRoleAdmin is not finished on the moment the jTable is loaded.
看起来jTable加载时ADRoleAdmin的加载尚未完成。
Try to start the jtable after a certain timeout to check. 尝试在超时后启动jtable进行检查。 Preferably load the ADRoleAdmin an on it's postback load the jTable
最好在其回发时加载ADRoleAdmin并加载jTable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.