1

I want to delete a row in the grid, but the grid always post's only the id and oper, I also want to post additional data.

My jqgrid is something like :

jQuery("#editgrid").jqGrid({
url:'autoJSON.php', datatype: "xml", colNames:['RowID','Asigurator','Cilindree','Persoana', 'Perioada', 'Pret'], colModel:[ {name:'rowID',index:'rowID', width:60, editable:true}, {name:'idAsigurator',index:'idAsigurator', width:100, editable:true,editoptions:{size:20}},
{name:'cilindree',index:'cilindree', width:90, editable:true,editoptions:{size:20}}, {name:'persoana',index:'persoana', width:300,editable:true,edittype:"select",editoptions:{value:"Persoana juridica:Persoana juridica;Pensionar:Pensionar;Persoana fizica:Persoana fizica"}}, {name:'perioada',index:'perioada', width:120, align:"right",edittype:"select",editable:true,editoptions:{value:"12 luni:12 luni;6 luni:6 luni"}}, {name:'pret',index:'pret', width:80, align:"right",editable:true,editoptions:{size:20}} ], width:900, height:600, pager: '#pagered', sortname: 'rowID', viewrecords: true, sortorder: "desc", caption:"Autoturisme", editurl:"autoPOST.php", }); jQuery("#editgrid").jqGrid('navGrid',"#pagered",{edit:true,add:true,del:true});

What should I do to access in autoPOST.php rowID also as a post variable.

Thanks


When trying to delete the only post variables I see are oper='del' and id that returns the id of the selected row i want to delete

casperOne
  • 73,706
  • 19
  • 184
  • 253
Arizona2014
  • 1,317
  • 2
  • 18
  • 33
  • this question is a duplicate of http://stackoverflow.com/questions/2833254/jqgrid-delete-row-how-to-send-additional-post-data – James Nail Oct 15 '10 at 11:37

2 Answers2

1

The id sent with the POST when you delete data should correspond to the rowId of each row. To make this happen, you need to add the following option to .jqGrid({ when the grid is intialized:

 xmlReader: {
            root:"xml", // Varies depending upon the structure of your XML
            row:"item", // Varies depending upon the structure of your XML
            repeatitems:false,
            id:"rowID"
}, 

Values of root and row will vary depending upon how your XML is named. The previous example will parse the following XML:

<xml>
 <item>
  <rowId>1</rowId>
  ...
 </item>
</xml>

Does that help?

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
1

Quoting your question "I also want to post additional data.", I assume you want to post another variable beside the rowId and 'del'. You can use postext plugin. This plugin provides additional API : setPostData(), setPostDataItem(), etc.

Jimmy Merari
  • 143
  • 1
  • 8