-
Notifications
You must be signed in to change notification settings - Fork 0
/
afterinsrow.js
37 lines (36 loc) · 1.23 KB
/
afterinsrow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
jQuery("#ainsrow").jqGrid({
url:'server.php?q=1',
datatype: "xml",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#painsrow',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"After insert row event",
multiselect: true,
afterInsertRow: function(rowid, aData){
switch (aData.name) {
case 'Client 1':
jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'green'});
break;
case 'Client 2':
jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'red'});
break;
case 'Client 3':
jQuery("#ainsrow").jqGrid('setCell',rowid,'total','',{color:'blue'});
break;
}
}
});
jQuery("#ainsrow").jqGrid('navGrid','#painsrow',{edit:false,add:false,del:false});