Is it really necessary to unload $("#myGrid").jqGrid('GridUnload');
if you want to set
again its colModels
and colNames
? Or should i say is it the only way to implement
a dynamic columns of jqGrid? Although I've tried that one and it worked.
But I also tried the setGridParam
of jqGrid but it wont work when i put colModels/colNames.
This is what i did aside from unloading
$.ajax({
url : url, //url the returns formatted colModels/colNames and other data
data : data,
async : false,
success : function(data){
$("#myGrid").setGridParam({
url : "xx/xxx/xx.json",
page : 1,
postData : {
.
.
.
},
colNames : data.returnedColNames,
colModel : data.returnedColModels,
rowNum : 50,
pager: '#myGridPager',
}).trigger("reloadGrid");
}
});
But i get and error like Uncaught TypeError: Cannot read property 'formatter' of undefined
Any ideas on this approach? Thanks in advance