好....首先我需要如何改变colmodel蒙山一个函数,调用一个SELECT,因为我的网有周期,有一个选择(成本和吨)的变化。
这是我的GRID
$("#grid").jqGrid({
.......
.......
url:'example1.json',
datatype: "json",
colNames: NAMESCOL,
colModel: MODEL,
.......
.......
caption:"Example 1"
});
其中NAMESCOL和型号是:
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}];
我的作用是:
function CHANGE(){
.......
.......
jQuery('#grid').jqGrid('clearGridData');
jQuery('#grid').jqGrid('setGridParam', {colModel: MODEL2});
jQuery('#grid').trigger('reloadGrid');
}
并尝试使用jQuery( '#线')的jqGrid( 'setGridParam',{数据:MODEL2})。 但只刷新相同的信息。
:(