代码之家  ›  专栏  ›  技术社区  ›  Arizona2014

删除时jqgrid附加post数据

  •  1
  • Arizona2014  · 技术社区  · 15 年前

    我想删除网格中的一行,但网格始终只发布id和oper,我还想发布其他数据。

    我的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});

    如何在autopost.php rowid中作为post变量进行访问。

    谢谢


    尝试删除时,我看到的唯一post变量是oper='del'和返回要删除的选定行的id的id

    2 回复  |  直到 12 年前
        1
  •  1
  •   Justin Ethier    15 年前

    这个 id 当您删除数据时随邮件发送的数据应与 rowId 每排的。要实现这一点,您需要将以下选项添加到 .jqGrid({ 当网格初始化时:

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

    价值观 root row 将根据XML的命名方式而有所不同。前面的示例将分析以下XML:

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

    有帮助吗?

        2
  •  1
  •   Jimmy Merari    15 年前

    引用你的问题 “我还想发布其他数据。”, 我想您需要在rowid和'del'旁边发布另一个变量。 你可以使用postext插件。此插件提供了额外的api:setPostData()、setPostDataitem()等。