1

How can I stop DetailGrid from not loading at page load. Because I have button in master grid to load Detail Grid. Below is code for 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 });
});
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144
Pirzada
  • 4,685
  • 18
  • 60
  • 113

1 Answers1

1

You should set datatype: "local" on the detail grid initially and change it to datatype: "json" before calling of jQuery("#list10_d").trigger("reloadGrid"):

jQuery("#list10_d").jqGrid('setGridParam',{datatype:"json"}).trigger("reloadGrid");
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • nice thanks. Can you reply to this please so that I mark it. http://stackoverflow.com/questions/4497252/jqgrid-button-in-master-grid-each-row-to-load-detail-grid/4519333#4519333 – Pirzada Dec 24 '10 at 12:52
  • @pirzada: Why you don't use up-voting (see http://stackoverflow.com/faq#howtoask)? You asked 39 questions and receive many answers. **Do you receive no answer which was helpful for you in any ways?** Starting with 15 points of reputation you can just clicking the upward pointing arrow to the left of the answer. In some situation the accepted answers will not calculated at all only voting up are important. So if you want be polite to people who give an answer on your question you should vote the answer up. You can also vote up any other question of answer which you found helpful or interesting – Oleg Dec 24 '10 at 13:26
  • What is the purpose of the trigger()? Do you need that to apply the grid param change, or can you reload the grid in a different way? –  Sep 29 '20 at 03:04
  • @KatherineCykes: `trigger("reloadGrid")` or `.triggerHandler("reloadGrid")` informs jqGrid that the grid need be reloaded. The corresponding handler of `reloadGrid` event (inside of jqGrid code) delete old HTML table, which represents the data and build new table with modified data. – Oleg Sep 29 '20 at 10:44