2010-03-24 96 views
1

我想刪除網格中的一行,但網格始終只發布id和操作符,我還想發佈其他數據。jqGrid刪除時的其他POST數據

我的jqgrid是這樣的:

 
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

+0

這個問題是http://stackoverflow.com/questions/2833254/jqgrid-delete-row-how-to-send-additional -post數據 – 2010-10-15 11:37:57

回答

1

The id當你刪除數據時應該與POST一起發送,應該對應於每行的rowId。要做到這一點,你需要在網格初始化爲以下選項添加到.jqGrid({:的rootrow

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" 
}, 

值將取決於你的XML是如何命名的不同而不同。前面的示例將解析以下XML:

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

這有幫助嗎?

+0

我使用Firebug刪除當ROWID心不是發來的POST變量... 當編輯ROWID是發送一個POST變量... 這是我的問題 – Arizona2014 2010-03-24 17:34:17

+0

我使用的XML是基於jqgrid庫的例子中提供的editing.php文件的例子,在飛行中創建。 – Arizona2014 2010-03-24 18:45:47

+0

您是否嘗試使用上述方法,或者它不適合您? – 2010-03-24 20:04:05

1

引用你的問題 「我也想發佈額外的數據」, 我假設你想在rowId和'del'旁邊發佈另一個變量。 您可以使用postext插件。這個插件提供了額外的API:setPostData(),setPostDataItem()等。