well.... first i need how change the colmodel whith a function that is call for a SELECT because my grid have periods and have a change with a select (cost and tons).
This is my GRID
$("#grid").jqGrid({
.......
.......
url:'example1.json',
datatype: "json",
colNames: NAMESCOL,
colModel: MODEL,
.......
.......
caption:"Example 1"
});
where NAMESCOL and MODEL is:
var NAMESCOL = ["plant","town","name plant","Total","period1","period2","period3"];
var MODEL = [{name:'id_plant',index:'id_plant',width: 40},
{name:'id_town',index:'id_town',width: 80},
{name:'name_plant',index:'name_plant',width: 110},
{name:'tot_ton',index:'tot_ton',width: 50},
{name:'ton_per1',index:'ton_per1',width: 50},
{name:'ton_per2',index:'ton_per2',width: 50},
{name:'ton_per3',index:'ton_per3',width: 50}];
var MODEL2 = [{name:'id_plant',index:'id_plant',width: 40},
{name:'id_town',index:'id_town',width: 80},
{name:'name_plant',index:'name_plant',width: 110},
{name:'tot_cost',index:'tot_ton',width: 50},
{name:'cost_per1',index:'cost_per1',width: 50},
{name:'cost_per2',index:'cost_per2',width: 50},
{name:'cost_per3',index:'cost_per3',width: 50}];
and my function is:
function CHANGE(){
.......
.......
jQuery('#grid').jqGrid('clearGridData');
jQuery('#grid').jqGrid('setGridParam', {colModel: MODEL2});
jQuery('#grid').trigger('reloadGrid');
}
and try using jQuery('#grid').jqGrid('setGridParam', {data: MODEL2}); but only refreshes the same information.
:(