Forum
08:03
28/04/2009
Howdy
Making good progress on my plugin for rails and jqgrid, I'm adding
support for the authenticity token. I'm attempting to use postData
to set the value to be passed back. I see it passed on all requests except
create. (Which of course is where I need it the most).
So what am I doing wrong here. Is there another option to the grid for the create action?
The jqgrid:
13:10
Moderators
30/10/2007
Hello,
I do not think that this is a bug. Actually we separate the data that is posted for editing, deleting and adding from those that is needed to load the data in the grid.
You do not do anything wrong. You need to use the events in adding record and extend the postData array with what you posted to the server.
Also some hint - you can use beforeSubmit event something like
beforeSubmit : function (mypostdata, formid) {
// get the postData array using getGridParam
// extend the postData with mypostdata array
// use setGridParam to update the postData
return [true,"",""];
}
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
00:17
28/04/2009
Cannot for the life of me, get the beforeSubmit to run.
Code looks right, least I should get a breakpoint on entry to the function in firebug, but nothing. It never gets called. I'm using the inline edit, just wondering if that is driving it crazy.
03:27
28/04/2009
Ok, I'll answer my own question. 🙂
The key to having this work is in the editRow, when you are doing the inline editing. As it does the save, and does not trigger other events.
I also found out that least in my Ruby 1.9.1 with Rails 2.3.2 the Javascript encodeURIComponent is redundant, and will cause the authenticitytoken not to work. (Despite plenty of examples that use it, possibly in older rails).
I can now do edits just fine with authenticyToken working as intended.
The final code:
Here is the wrong way, with the encodeURIComponent:
Processing AirstateController#index to xml (for ::1 at 2009-05-14 16:09:31) [GET]
Parameters: {"nd"=>"1242288570914", "_search"=>"false", "rows"=>"10", "page"=>"1", "sidx"=>"id", "sord"=>"desc", "controlle"*********HERE******** "
"GoSD7xNPpttz2h2VjDyi28rt6pXPao7KsMdnzPGBr3I="
"GoSD7xNPpttz2h2VjDyi28rt6pXPao7KsMdnzPGBr3I%3D"
05:54
28/04/2009
Ok, I spoke to soon, (After I pushed to github too).
The delete request (And I assume the add as well) need the
extra parameters. I tried postData, but doent seem the right place.
Is there a event, or is there a parameter?
Processing AirstateController#create (for ::1 at 2009-05-14 18:45:37) [POST]
Parameters: {"oper"=>"del", "id"=>"1564", "controller"=>"airstate", "action"=>"create"}
21:51
28/04/2009
Ok, resolved. I've moved to stuffing the token in the editurl.
That solves it for add/update/delete. Looks like delData
cannot be set in the grid definition, which I would have expected
to work. From reading the code, only can be passed on the function call.
I've updated the plugin, and pushed it to github if anyone wants to see.
Thanks for the support.
Oh by the way, is there a update for the forum, the captcha has a wonderful way of losing my posts, third time to type this one.
Most Users Ever Online: 715
Currently Online:
45 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66