PDA

View Full Version : Submitting ListView/GridPanel trough a form....



drunkmoose
28 Mar 2011, 10:59 AM
Hi there,

I've been struggling to get those kind of components to post their data when the form submits.

If I get it right, the object returned by getFieldValues() should show me what the server side script will see, right ?

Unfortunately, I am not seeing the ListView/GridPanel data in that returned object.

I've read that I could use a hidden field, but my GridPanel has got many columns so I don't know how I could do it trough that trick.

Isn't it possible to just get the ListView/GridPanel to POST its store to the server side script ?

How would you guys do that ?

Thanks,

kohyea
28 Mar 2011, 11:55 AM
Can you please POST your sample code?

drunkmoose
28 Mar 2011, 12:24 PM
So it's a problem with my code ? Those components _should_ be returned by getFieldValues() ?

OK, let me anonymize the code and I'll post it up.

fay
29 Mar 2011, 3:12 AM
Those components _should_ be returned by getFieldValues() ?

Short answer, no. They are not fields of the form so getFieldValues will have no affect on them. You need to post the grid/view's underlying store, and I'd imagine that you'd just want to send the new/modified records. To do so you can add an additional param to the form's submit (http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.BasicForm&member=submit) method with your records encoded in whatever way the server expects them. Tbh, I'd probably seperate out the form's submission from the updating of the grid/view's data on the server and use a writer (http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.DataWriter) with batch updates.

drunkmoose
30 Mar 2011, 6:55 AM
Thanks for your input.

I'll look into your suggestions.

drunkmoose
30 Mar 2011, 11:31 AM
The problem is that this store cannot have a writer AFAIK. The writer will complain about the store not having an URL, which is obviously OK since it is a local store with a MemoryProxy. But I need the content of that store to get to the server somehow.

I tried turning it into an XmlStore with an XmlReader (so I could post the xml data to the server and parse it over there) and getting the xmlData property from the reader, but it's empty.

Unfortunately, the node and json properties of the records are null since the records were not added via the reader, apparently.

Apparently, loading a record like this does not count as using the store's reader:


store.add(new store.recordType({id:"0",display_name:"Display Name"},0));

Any ideas ?

EDIT: I think I'll switch to JSON on the server end and use: http://www.sencha.com/forum/showthread.php?39578-send-store-through-post