Friday 15 April 2011

JQGrid: creating dynamically a RESTFul URI with id appended -


When submitting jqGrid form, I add URL / RECardId to URL, REST style for the case of editing / use Want to It is not working:

  jQuery ("# ​​note list"). JqGrid ('Navigrade', '# pager', {edit: "Add new note", clear now add: true}, {addCaption: "edit note", type: "fold", onclick submit: function (rp_j, Postdata) {rp_ge.url = editurl + '/' + postdata.id;}}, {addCaption: "add new note", mitip: "post"}, {}, {}, {});   

The result is being sent to "/ [myurl] / undefined" server (where [myurl] is the correct initial editurl). Therefore dynamic URL manipulation works, but 'id' is unspecified. What should be the name of the 'id' property? I can see what is being passed as a form parameter 'id' I even tried the note id, which is the name of the data in the coming data displaying the grid, and also for the JasonRadder.Id Had used it. Either did not work, or where should the name of this specialty be? Perhaps you used an example created for older versions of jqGrid, the current version of JqGrid < Code> {gridid} _id as the property of the id value, for example if the grid used by you is id Note list then the note list_id is the property of the ID code PostData onclick submit . It is important to understand that later , after submit onclick and before , the property name noteList_id ID for (see).

You can fix the code on the onclickSubmit

  submit onclick: function (Options, PostData) {options.url = editurl + '/' + encodeurIC component (PostData [this.id + "_id"]); }   

I have included the JavaScript function call to ensure that the URL will be correctly encoded in the case of any character used in id .

No comments:

Post a Comment