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_Related Related Topics sp_TopicIcon
no key on delete call
13/02/2011
03:17
Avatar
logemann
Member
Members
Forum Posts: 6
Member Since:
13/02/2011
sp_UserOfflineSmall Offline

Hi,

i am trying to implement the delete feature but i have problems submitting the key of the row. Of course this should be handled by jqgrid correct? Can you gimme a hint why the resulting request is only the call to the defined URL without any parameter (key) in it?

$(document).ready(function() {
            jQuery("#list4").jqGrid({
                url:'/foo/country/CountryManager2.app',
                editurl:"/foo/country/CountryManager2.app",
                datatype: "json",
                colNames:['ISO Num.','ISO Alpha', 'Bezeichnung', 'PLZ','Waehrung'],
                colModel:[
                    {name:'isoCodeNr',index:'isoCodeNr', width:85, key:true},
                    {name:'nameIsoCode2',index:'nameIsoCode2', width:90},
                    {name:'name',index:'name asc, invdate', width:180},
                    {name:'postalCode',index:'postalCode', width:80, align:"right"},
                    {name:'currencyName',index:'currencyName', width:90, align:"right"}
                ],
                rowNum:10,
                rowList:[10,20,30],
                pager: '#pjmap',
                sortname: 'nameIsoCode2',
                viewrecords: true,
                sortorder: "desc",
                jsonReader: {
                    repeatitems : false,
                    root:"records",
                    page: "currPage",
                    total: "totalPages",
                    records: "totalRecords",
                    id: "0"
                },
                caption: "JSON Mapping",
                height: '100%' });

            jQuery("#list4").jqGrid('navGrid', '#pjmap',
            {add:false,edit:false,del:true,search:false},
            {},
            {},
            {
                mtype:"DELETE"
            });
        });

Thx for hints. I googled and tried for hours without success. I still think that i dont need to get into the whole event thing myself (override) because the demos told me that this is not needed. Perhaps i have a problem with my jsonreader not recognizing the key or something.

Marc

13/02/2011
03:34
Avatar
logemann
Member
Members
Forum Posts: 6
Member Since:
13/02/2011
sp_UserOfflineSmall Offline

Ok. Seems my question makes no sense because a DELETE request cant have "POST" data 😉 Furthermore before specifying DELETE, i defined POST of course just to check it but then i obviously made a different mistake. Now POST works but i dont want to use POST 😉  Considered that i really want to use DELETE to call the server, it seems i need to rewrite the URL so that i can append my "key" to the base url, correct?

Marc

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

Hi Marc,

You can use onclickSubmit to append the id to the url and use serializeDelData additionally to clear the body of the HTTP DELETE request. Then you can use mtype:"DELETE" and have jqGrid delete request which will be full conform to RESTfull services. See for example this answer. You should examine which postdata you have inside of onclickSubmit event handler and decide what data you want append to the url.

Best regards
Oleg 

13/02/2011
14:10
Avatar
logemann
Member
Members
Forum Posts: 6
Member Since:
13/02/2011
sp_UserOfflineSmall Offline

Yeah you are absolutely right. I have done it this way, perhaps not completely finished but it works for my prototype....

jQuery("#list4").jqGrid('navGrid', '#pjmap',
            {add:false,edit:false,del:true,search:false},
            {},
            {},
            {
                mtype:"DELETE",
                /*
                 serializeDelData: function (postdata) {

                 return "";
                 }, */
                onclickSubmit: function (grid, postdata) {
                    grid.url = jQuery("#list4").jqGrid('getGridParam', 'url') + "/" + postdata;
                    return {};
                }
            });

Perhaps this might help others too. BTW the documentation for the onclickSubmit event is really worse with regard to signature. 🙂

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
42 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