我想在插入行後使用jqgrid添加條件格式。然而似乎沒有任何事情發生。我在過去使用afterInsertRow並且工作正常。有什麼建議麼?jqgrid條件格式。
jQuery("#gridDevicePlan").jqGrid
({
url:'/dashboard/summarydeviceplans',
datatype: "json",
colNames:['Temporal','Short Name','Customer', 'Start', 'End', 'Duration', 'Device Count'],
colModel:[ {name:'Temporal',index:'Temporal'},
{name:'ShortName',index:'ShortName'},
{name:'Customer',index:'Customer'},
{name:'DateStart',index:'DateStart',formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s', newformat:'m/d/Y H:i'}},
{name:'DateStop',index:'DateStop',formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s', newformat:'m/d/Y H:i'}},
{name:'Duration',index:'Duration'},
{name:'DeviceCount',index:'DeviceCount'}
],
//multiselect: true,
rowNum:10,
rowList:[10,50,100,300],
//autowidth: true,
autowidth: true,
height: 'auto',
pager: '#pagerDevicePlan',
sortname: 'ShortName,Customer,DateStart',
mtype: "POST",
editurl:'/deviceplan/abort',
postData:{'deviceIDs[]':$('#device').val(),
'timezone':<?="'".$this->criteria['timezone']."'"?>,
'gmtStartDate':<?="'".$this->criteria['gmtStartDate']."'"?>,
'gmtStopDate':<?="'".$this->criteria['gmtStopDate']."'"?>
},
viewrecords: true,
sortorder: "asc",
grouping: true,
caption:false,
afterInsertRow: function(rowid, aData) { //set condiditonal formatting
alert(aData.Temporal);
if(aData.Temporal != 'Current'){
$("#"+rowid).addClass("ui-state-error");
}
}
});
jQuery("#gridDevicePlan").jqGrid('navGrid','#pagerDevicePlan',{edit:false,add:false,del:false});
從不介意,採取分組,它的工作原理。 –