Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
REST support
20/01/2011
10:52
Avatar
ludoo
Member
Members
Forum Posts: 5
Member Since:
03/01/2011
sp_UserOfflineSmall Offline

Please add a native way to support REST methods in formedit.

This will be a great addition !

I've got a working solution as a personal patch for 3.8.2, but a native solution will be great !

Thansk

LudoO

20/01/2011
14:10
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello LudoO,

RESTful services on the server side are supported since a long time by jqGrid. To load data from the REST you can use

ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
    serializeGridData: function (postData) {
    return JSON.stringify(postData);
}

where JSON.stringify function (the corresponding JavaScript can be downloaded from http://www.json.org/js.html).

To use almost the same setting for formedit:

ajaxEditOptions: { contentType: "application/json; charset=utf-8" },
serializeEditData: function (postdata) {
    return JSON.stringify(postData);
}

You can set the settings per jQuery.extend(jQuery.jgrid.edit, {...}); and jQuery.extend(jQuery.jgrid.del, {...});.

To use URL in RESTfull style for Add/Edit

onclickSubmit: function(rp_ge, postdata) { rp_ge.url = urlEdit + '/' + postdata.list_id; }

and for Delete

serializeDelData: function (postdata) {
    return ""; // the body MUST be empty in DELETE HTTP requests
}

Here are some links with the code examples: this, this, this, this, this.

Best regards
Oleg 

20/01/2011
18:20
Avatar
ludoo
Member
Members
Forum Posts: 5
Member Since:
03/01/2011
sp_UserOfflineSmall Offline

Thanks for really useful informations ans links !

But i don't find where the methods PUT, POST, DELETE, GET are set depending on CRUD operation.

And i encountered a JSON conversion mapping since JSON should be strong typed and grid always returns String ("true" instead true...)

Regards

LudoO

20/01/2011
20:09
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

You can use mtype option:

$("#list").jqGrid('navGrid','#pager', {},
                       { mtype: "PUT" },   // Edit options
                       { mtype: "POST" }, // Add options
                       { mtype: "DELETE" }); // Del option

To set delete option you can use also  jQuery.extend(jQuery.jgrid.del, {mtype: "DELETE"});

Best regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
67 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information