jQuery("#a1").click( function(){
//获取Grid中选中的行id
var id = jQuery("#list5").jqGrid('getGridParam','selrow');
if (id) {
var ret = jQuery("#list5").jqGrid('getRowData',id);
alert("id="+ret.id+" invdate="+ret.invdate+"...");
} else {
alert("Please select row");
}
});
jQuery("#a2").click( function(){
//删除第12行
var su=jQuery("#list5").jqGrid('delRowData',12);
if(su)
alert("Succes. Write custom code to delete row from server");
else
alert("Allready deleted or not in list");
});
jQuery("#a3").click( function(){
//修改第11行
var su=jQuery("#list5").jqGrid('setRowData',11,{amount:"333.00",tax:"33.00",total:"366.00",note:"<img src='images/user1.gif'/>"});
if(su)
alert("Succes. Write custom code to update row in server");
else
alert("Can not update");
});
jQuery("#a4").click( function(){
//添加第99行(id为99的)
var datarow = {id:"99",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"};
var su=jQuery("#list5").jqGrid('addRowData',99,datarow);
if(su)
alert("Succes. Write custom code to add data in server");
else
alert("Can not update");
});