2015-10-16 42 views
0

嗨,我努力顯示我的jtable。它只在我用調試器遍歷javascript時顯示。Jtable只顯示在通過調試器步進時

$("body").on("click", "#tabRole", function() { 
     document.getElementById("1").className = "inactive"; 
     document.getElementById("2").className = "active"; 

     $('#Admin-details').load('../Admin/ADRoleAdmin'); 
     jTableRoles(); 
    }); 

此方法將ADRoleAdmin作爲局部視圖加載到div中。然後jTableRoles()應該JTable中加載到一個div(jTableRoles)內ADRoleAdmin:

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'); 
    }); 
} 

請告訴我,我做錯了還是什麼我可以做的不同,以使其發揮作用。

回答

0

循環執行步驟需要額外的時間。 看起來ADRoleAdmin的負載在jTable加載的那一刻沒有完成。

嘗試在特定的超時後啓動jtable來檢查。 優先加載ADRoleAdmin並對其進行回發加載jTable

相關問題