-
24 Nov 2008 5:30 AM #1
editorgridpanel in formpanel need to post all rows as array within the form
editorgridpanel in formpanel need to post all rows as array within the form
hi I am a newbie in extjs,
I need a sample to post all the data in the store of my editorgridpanel, within the form
I am using browser submit not ajax and have several other components in the form together with the grid,
my editor grid works good inside I DD rows from another grid panel and let the user edit the added rows, and when save button is pressed, I wanna post the editorpanel values like
editorrows[
[1,2,true,'yes'],
[2,3,false,'yes'],
]
I add name property in editor option of the column model but it did not work when form submitted, it send only 'one' modified value in that column like column1='sth'
need some guiding please
-
24 Nov 2008 9:00 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
I would copy the data from the store a hidden field, e.g.
Code:var rows = []; store.each(function(r){ var row = []; store.fields.each(function(f){ row.push(r.get(f.name)); }); rows.push(row); }); Ext.getCmp('id-of-hidden-field').setValue(Ext.encode(rows));
-
24 Nov 2008 11:03 AM #3
thanks a lot it works but the thing it sends a jason encoded string
but not an arrayofarrays
any other encoding utility in EXt to encode object as arrays to put into an array input in the form ?
Another question is that there exists an option in basicform "standardSubmit" but i guess it does not post the params option and baseParams OR I could not find how to do it
-
24 Nov 2008 11:21 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
1. A standard POST only has name/value pairs. How would you expect to post an array of arrays?
2. A standard submit indeed only submits the form elements and not any baseParams etc.
-
24 Nov 2008 11:51 AM #5
umm, well then it means I am gonna add hidden inputs to the form with names colum1[] column2[], or use ajax request and success/failure actions to decide on what to do with the response, the second one is easier I think
I found that php 5.2 has json decode/encode extension that will help me a lot
thank u very much Condor, for your attention and replying to my beginner class questions
-
24 Nov 2008 7:25 PM #6
There's another way presented here:
http://extjs.com/learn/Ext_FAQ_Grid#Grid_within_form
If you use standard submit then the params won't be included when the form is submitted, you have to use hidden fields if you want to use standard submit.MJ
API Search || Ext 3: docs-demo-upgrade guide || User Extension Repository
Frequently Asked Questions: FAQs
Tutorial: Grid (php/mysql/json) , Application Design and Structure || Extensions: MetaGrid, MessageWindow


Reply With Quote