Forum
12:11
28/08/2009
Hi,Tony
when the status of one cell was "cell Editing",and click "remove this row" button,the row which was selected currently will be removed.
and select a new row randomly,
if there is one row which "row index" is the same as former(has been removed),the value of cell will be clear;
else the cell value of first row will be clear and grid's "cell editing" feature will invalid.
jQuery("#list4").jqGrid({
datatype: "local",
height: 250,
cellEdit: true,
cellsubmit: 'clientArray',
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:60, sorttype:"int"},
{name:'invdate',index:'invdate', editable:true, width:90, sorttype:"date"},
{name:'name',index:'name', editable:true, width:100},
{name:'amount',index:'amount', editable:true, width:80, align:"right",sorttype:"float"},
{name:'tax',index:'tax',editable:true,width:80,align:"right",sorttype:"float"},
{name:'total',index:'total', editable:true,width:80,align:"right",sorttype:"float"},
{name:'note',index:'note', editable:true, width:150, sortable:false}
],
imgpath: 'images',
toolbar: [true,'top'],
caption: "Cell Editing"
});
$("#t_list4").append("");
var mydata = [ {id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"} {id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"}, {id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}, {id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}
];
for(var i=0;i<=mydata.length;i++) jQuery("#list4").addRowData(i+1,mydata[i]); //remove method function removeRow(){ var id = jQuery("#list4").getGridParam('selrow'); if (id) { var ret = jQuery("#list4").getRowData(id); jQuery("#list4").delRowData(ret.id); } else { alert("Please select row"); } }
Most Users Ever Online: 715
Currently Online:
55 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66