开发者

jqgird. how to change form field names?

I'm using jqgrid to represent my data. I added a form to my grid. when jqgrid are posting data to server, I want to change the name of the field. ex:

{name:'istenenDepo.adi', index:'istenenDepo.adi',editable:true,
                   editable: true,
                   edittype:"select",
                editoptions:{
                    value:"#{list items:depoList, as:'depo'}${depo.id}:${depo};#{/list}",
                    dataEvents: [
                  {  type: 'change',
                     fn: function(e) {
                        $('input#istenenDepoId').val(this.value);
                     }
                  }
               ]
                },
                formoptions:{
                    elmprefix:"    "
                }
            }

Normally it sends data to server with the field name of istenenDepo开发者_C百科.id, but I want to change it like malzemeIstek.istenenDepo.id. ex: it post like

myurl?istenenDepo.adi=1&isteyenDepo.adi=1&istekZamani=2011-09-08&isteyenKullanici=fyfry&istenenDepo.id=&isteyenDepoId=1&oper=add&id=_empty
but we want

myurl?malzemeIstek.istenenDepo.adi=1&malzemeIstek.isteyenDepo.adi=1&malzemeIstek.istekZamani=2011-09-08&malzemeIstek.isteyenKullanici=fyfry&malzemeIstek.istenenDepo.id=&malzemeIstek.isteyenDepoId=1&oper=add&id=_empty

Thanks in advance


You can use serializeEditData event which is fired before post and it allows you to mingle with data to be posted.

To quote docs:-

If set this event can serialize the data passed to the ajax request when we save a form data. The function should return the serialized data. This event can be used when a custom data should be passed to the server - e.g - JSON string, XML string and etc. To this event is passed the data which will be posted to the server.

Please look here for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜