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
jquery alpha 3 and postdata with create action
13/05/2009
08:03
Avatar
glennswest
Member
Members
Forum Posts: 8
Member Since:
28/04/2009
sp_UserOfflineSmall Offline

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:

http://www.pastie.org/476753

13/05/2009
13:10
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

14/05/2009
00:17
Avatar
glennswest
Member
Members
Forum Posts: 8
Member Since:
28/04/2009
sp_UserOfflineSmall Offline

Cannot for the life of me, get the beforeSubmit to run.

http://www.pastie.org/477666

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. 

14/05/2009
03:27
Avatar
glennswest
Member
Members
Forum Posts: 8
Member Since:
28/04/2009
sp_UserOfflineSmall Offline

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:

http://www.pastie.org/477749

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"

Notice the "=" has been encoded in the one we are returning, but not
the one we are comparing it too.
After we remove the encodeURIComponent, the comparison is good:
"*********HERE******** "
"GoSD7xNPpttz2h2VjDyi28rt6pXPao7KsMdnzPGBr3I="
"GoSD7xNPpttz2h2VjDyi28rt6pXPao7KsMdnzPGBr3I="
Thanks for the help. Now on to the next issue. 🙂
14/05/2009
05:54
Avatar
glennswest
Member
Members
Forum Posts: 8
Member Since:
28/04/2009
sp_UserOfflineSmall Offline

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"}

14/05/2009
21:51
Avatar
glennswest
Member
Members
Forum Posts: 8
Member Since:
28/04/2009
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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