PDA

View Full Version : What gets posted to the server from the editorgrid?



Bogdan0x400
23 Feb 2011, 4:00 AM
I've read some FAQ, some docs and some books and I still don't get it what exactly gets posted back from the editorgrid? I've read that data saving should be handled manually. How should I configure the grid if I want to simply postback it's entire content to the server? Also, what postback configurations are available?

Condor
23 Feb 2011, 4:13 AM
An EditorGridPanel isn't a form field, so it doesn't post any data.

However, if you defined your store with a 'writer' then any change will be posted to the server as create, update or delete request.

If you don't use a 'writer', then you manually need to collect the store data and send it to the server using an Ext.Ajax.request (sounds like you want this).

Bogdan0x400
23 Feb 2011, 5:10 AM
That's it, I need to configure a store writter! Thanks!

Bogdan0x400
23 Feb 2011, 9:07 AM
No, that appeared not the thing I need. What I need is for the editorgrid to submit it's whole data to the server when user clicks submit button. To be more precise, I have an editorgrid in one of Ext.ux.Wizard's steps, and I need the whole data to be posted back when the user finishes the wizard. The grid uses JsonStore, but the store uses the data property, not url property, so no AJAX requests are made.

Bogdan0x400
23 Feb 2011, 9:10 AM
Here's what I am planning to do:

Create a hidden text field with a name set on it.
On the wizard's finish button click, serialize grid's data to this hidden field's value.

Is this a good solution?

drian
23 Feb 2011, 9:57 AM
when you're saving the form, why don't you use .each on the datastore of that grid and fetch the value of all the rows?


datastore.each(function(record){
// print a grid column
console.log(record.get('name of the field in the datastore'));
});

Condor
23 Feb 2011, 11:28 PM
You don't need a hidden field, unless you are planning to do a standard submit (with redirect to a new page). Othewise you can simply add the parameter to the request.

Bogdan0x400
24 Feb 2011, 12:07 AM
You don't need a hidden field, unless you are planning to do a standard submit (with redirect to a new page). Othewise you can simply add the parameter to the request.
You mean the store's baseParams property?

Condor
24 Feb 2011, 12:14 AM
No, I meant the BasicForm submit() 'params' option.