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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -