I have create a gird uing jqgrid and in that i am using form dialog to add , edit and delete record.
but in Edit Record i want to pass the id of a record along with the url
even though form data will contain that , as i am using RESTful url so to update a record i have to pass
the respective ID. as follow
www.example.com/eventInfo/10 , Method is PUT
so far i have tried
jQuery("#eventGrid").jqGrid('navGrid','#pager', {}, //options
{
height:280,
reloadAfterSubmit:false ,
// How can i add Event id over here from grid
url:'http://www.eample.com/evenInfo',
mtype:'PUT'
}, // edit options
{
height:280,
reloadAfterSubmit:false
}, // add options
{
reloadAfterSubmit:false
}, // del options
{
} // search options
);
Moreover i want to send data to server in a JSON format rather then as form data
I described here detailed what you should do in case of working with RESTful services. The callback
onclickSubmit
is the best place to modify URL dynamically and append theid
to it.The current code of jqGrid which are on the github set the DOM element of the grid as
this
. So you will be able to use the followingin the next (after 4.3.1) version of jqGrid. In the current version of jqGrid the code will be about the following
In the above code I added the
afterSubmit
which is important because you usereloadAfterSubmit: false
option.Remark: I typed mostly the code above or used cut & paste to copy some parts from another old answers. So you should test the above code in your application.