-
30 Jan 2009 8:20 AM #1
multi-column combobox via JSON?
multi-column combobox via JSON?
Hi. I have a form that is loading purely via JSON. like so:
// grab raw JSON layout from php file:
FormJSON=Ext.decode(GetFormJSON('myformjson.php?s='+seqno));
// now create FormPanel to insert into window...
var frm=new Ext.FormPanel(FormJSON);
The form popups up great with comboboxes etc but what i need is to make my comboboxes multi-column. I can specify my single column comboboxes no problem via:
{
xtype:'combo',
triggerAction:'all',
fieldLabel: 'Employee',
store:'["John","Sue","Frank"]',
name: 'employee',
value:'',
},
I've tried store: '[{"1","John"},{"2","Sue"},{"3","Frank"}]' but that doesn't work either. What is the format?
Thanks for any help!
Kevin.
-
30 Jan 2009 8:23 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
The syntax for a static store of a combobox with a displayField/valueField config is:
But I don't think this is what you are asking...Code:[["1","John"],["2","Sue"],["3","Frank"]]
-
30 Jan 2009 8:40 AM #3
Thanks Condor.
Well, yes, that is what i'm asking. I just tried it and it it worked!
Sorry to lead this along but where is that going to show up when it posts to the server when I save the record, only the name (ie Frank) shows up not the id.
Regards
Kevin.
-
30 Jan 2009 8:47 AM #4
Condor,
Actually let me clarify, but you have solved 1/2 my problem...
I can now get the display correct with the names of the employees, I didn't know about the displayField/valueField thing. How would I specify that the 1st element is the value and the 2nd is the Display and to post the value when it does the AJAX save later? I don't name the columns so I can't give them a name. On post I only get the displayValue (Frank).
Regards,
Kevin.
-
30 Jan 2009 11:18 AM #5
SOLVED!
OK for the benefit of others, here is the solution:
{
xtype:'combo',
triggerAction:'all',
fieldLabel: 'Employee',
store:'[["1","John"],["2","Sue"],["3","Frank"]]',
name: 'employee',
value:'',
hiddenName: 'employee'
},
So i added "hiddenName", that makes it post the value not the text on the post.
Thanks for everyone's help, especially Condor.
Kevin.
-
30 Jan 2009 11:44 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Correct, the only thing you can leave out is the name:'employee' (it's either name or hiddenName, but not both).


Reply With Quote