停止在页面加载时加载详细信息网格

时间:2010-12-24 04:28:49

标签: jquery jqgrid

如何阻止DetailGrid在页面加载时不加载。因为我在主网格中有按钮来加载细节网格。下面是Detail Grid的代码。

jQuery().ready(function () {
    jQuery("#list10_d").jqGrid({
        height: 100,
        url: '/JQSandbox/MyFullSubGridData?id=0',
        datatype: "json",
        mtype: 'POST',

        colNames: ['Index', 'Name', 'Department', 'Hire Date', 'Supervisor'],
        colModel: [
            { name: 'employeeID', index: 'employeeID', width: 10 },
            { width: 30 },
            { name: 'employeeDepartment', index: 'employeeDepartment', width: 30 },
            { name: 'employeeHiredate', index: 'employeeHiredate', width: 40, sortable: false },
            { name: 'employeeSup', index: 'employeeSup', formatter: 'checkbox', align: 'center', width: 30, search: false }
        ],

        loadtext: "",
        loadui: "block",

        width: 500,
        rowNum: 5,
        rowList: [5, 10, 20],
        pager: '#pager10_d',
        sortname: 'employeeID',
        viewrecords: true,
        sortorder: "asc",
        multiselect: true,
        caption: "Detail Grid: 1"
    }).navGrid('#pager10_d', { add: false, edit: false, del: false });
});

1 个答案:

答案 0 :(得分:1)

您最初应在详细信息网格上设置datatype: "local"并在<{strong>>调用datatype: "json"之前将其更改为jQuery("#list10_d").trigger("reloadGrid")

jQuery("#list10_d").jqGrid('setGridParam',{datatype:"json"}).trigger("reloadGrid");