To call a PUT REST API from JQGrid, you can use the ajaxGridOptions
property of JQGrid to customize the AJAX settings for the grid. Here are the steps you can follow:
- Define your JQGrid configuration and set the
ajaxGridOptions
property with thetype
option set to"PUT"
to indicate that you want to use the PUT method:
javascript$("#grid").jqGrid({
url: "your_api_url",
mtype: "GET",
datatype: "json",
colNames: ["Column 1", "Column 2"],
colModel: [
{ name: "col1", index: "col1", width: 100 },
{ name: "col2", index: "col2", width: 100 },
],
ajaxGridOptions: { type: "PUT" },
});
- Set the
editurl
property of JQGrid to your API endpoint:
javascript$("#grid").jqGrid("navGrid", "#pager", { edit: false, add: false, del: false });
$("#grid").jqGrid("inlineNav", "#pager", {
edit: true,
add: true,
save: true,
cancel: true,
editurl: "your_api_url",
});
- Handle the PUT request on your server-side API and update the database accordingly.
Note that you may also need to include any necessary authentication tokens or headers in your AJAX request, depending on your API requirements.
Comments
Post a Comment