Jtable仅在单步执行调试器时显示

时间:2022-10-19 18:41:51

Hi I am struggling to display my jtable. It only displays when I step through the javascript with the debugger.

嗨,我正在努力展示我的jtable。它仅在我使用调试器逐步执行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. Then jTableRoles() should load the jtable into a div (jTableRoles) inside ADRoleAdmin:

此方法将ADRoleAdmin作为局部视图加载到div中。然后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.

请告诉我我做错了什么或者我可以做些什么来使它工作。

1 个解决方案

#1


0  

Looping through the steps takes extra time. It looks like the load of ADRoleAdmin is not finished on the moment the jTable is loaded.

循环执行这些步骤需要额外的时间。看起来ADRoleAdmin的加载在加载jTable时没有完成。

Try to start the jtable after a certain timeout to check. Preferably load the ADRoleAdmin an on it's postback load the jTable

尝试在一定的超时后启动jtable进行检查。最好将ADRoleAdmin加载到它的回发加载jTable上

#1


0  

Looping through the steps takes extra time. It looks like the load of ADRoleAdmin is not finished on the moment the jTable is loaded.

循环执行这些步骤需要额外的时间。看起来ADRoleAdmin的加载在加载jTable时没有完成。

Try to start the jtable after a certain timeout to check. Preferably load the ADRoleAdmin an on it's postback load the jTable

尝试在一定的超时后启动jtable进行检查。最好将ADRoleAdmin加载到它的回发加载jTable上