setting jqGrid data after the grid has been created -
the following example code load jqgrid (this code works) ...
jquery(document).ready(function () { var griddata = [ { col1: 'cell11', col2: 'cell12', col3: 'cell13' }, { col1: 'cell21', col2: 'cell22', col3: 'cell23' } ]; $('#mygrid').jqgrid({ data: griddata, datatype: 'clientside', colnames: ['col1', 'col2', 'col3'], colmodel: [ { name: 'col1' }, { name: 'col2' }, { name: 'col3' } ] })
how rewrite example griddata set after jqgrid created? tried this...
jquery(document).ready(function () { var griddata = [ { col1: 'cell11', col2: 'cell12', col3: 'cell13' }, { col1: 'cell21', col2: 'cell22', col3: 'cell23' } ]; $('#mygrid').jqgrid({ datatype: 'clientside', colnames: ['col1', 'col2', 'col3'], colmodel: [ { name: 'col1' }, { name: 'col2' }, { name: 'col3' } ] }) $('#mygrid')[0].data = griddata;
however above code doesn't work. can show me how please?
update: tried last line, didn't work either...
$('#jqgrid-panel-contents').jqgrid('setgridparam', {data: griddata});
maybe try reloading grid afterwards?
$('#jqgrid-panel-contents').jqgrid('setgridparam', {data: griddata}).trigger('reloadgrid');
Comments
Post a Comment