views:

387

answers:

5
A: 

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
I'm using FIREBUG and the rowID isnt sent as a POST variable when deleting...When editing the rowID is send as a POST variable ...That's my problem
The XML I use is created on the fly based on the example of editing.php file provided in the examples of jqgrid library.
Did you try using the method above, or is it not working for you?
Justin Ethier
A: 

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

A: 

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
A: 

I tryed your approach with the following code

jQuery("#editgrid").jqGrid({        
    url:'autoJSON.php?id=<?php echo $id; ?>',
    datatype: "xml",
    colNames:['RowID','Asigurator','Specificatii','Persoana', 'Perioada', 'Pret'],
    colModel:[
        {name:'rowID',index:'rowID', width:60, editable:true},
        {name:'idAsigurator',index:'idAsigurator', width:100, editable:true,editoptions:{size:20}},     
        {name:'specificatii',index:'specificatii', width:200, 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}} 
    ],
    xmlReader: {
            root:"rows", 
            row:"row",
            page:"page", 
            total:"total", 
            records:"records",
            repeatitems:false,
                id:"rowID"
    }, 

the xml file looks like this

<rows>
<page>1</page>
<total>1</total>
<records>5</records>
−
<row>
<cell>1</cell>
<cell>1</cell>
<cell>1401-1600 cmc</cell>
<cell>Pensionar</cell>
<cell>12 luni</cell>
<cell>155</cell>
</row>
−
<row>
<cell>2</cell>
<cell>1</cell>
<cell>1401-1600 cmc</cell>
<cell>Pensionar</cell>
<cell>12 luni</cell>
<cell>200</cell>
</row>
−
<row>
<cell>3</cell>
<cell>1</cell>
<cell>1401-1600 cmc</cell>
<cell>Pensionar</cell>
<cell>12 luni</cell>
<cell>300</cell>
</row>
−
<row>
<cell>4</cell>
<cell>1</cell>
<cell>1401-1600 cmc</cell>
<cell>Pensionar</cell>
<cell>12 luni</cell>
<cell>400</cell>
</row>
−
<row>
<cell>11</cell>
<cell>1</cell>
<cell>1401-1600 cmc</cell>
<cell>Pensionar</cell>
<cell>12 luni</cell>
<cell>500</cell>
</row>
</rows>

Unfortunatelly when I add the xmlReader option the grid displays only empty rows so can you please tell me what I do wrong

Thanks

A: 

I'm having the same problem...how to add other parameters...user_id for example (from the same grid)??

I can get the user_id value but couldn't figure out how to send it as POST data.

What I tried was to add the Post data on onclickSubmit event...

onclickSubmit: function(rowid) {

var val = $('#tags').getCell(rowid, 'user_id');

return {user_id:val};

}

ronanray