PDA

View Full Version : Need EditorGrid ComboBox store help



UGA_Zimma
17 Nov 2009, 1:00 PM
I am looking to have a Combobox in an editorgrid populate from a list of strings returned in a JSON response from the server. Here is what I am currently trying:

EditorGrid:



{
xtype:'editorgrid',
width:900,

height:300,
id:'testGrid',
store:testStore,
monitorResize:true,
autoScroll:true,
frame:false,
defaults:{
width:100,
sortable:true
},
columns:[
new Ext.grid.RowNumberer(),
{header:'Test Col1', dataIndex:'testCol1'},
{header:'Test Col2', dataIndex:'testCol2', editor:new Ext.form.ComboBox({
store: ??,
typeAhead:true,
forceSelection:true,
triggerAction:'all',
selectOnFocus:true
})
},
{header:'Test Col3', dataIndex:'testCol3'},
{header:'Test Col4', dataIndex:'testCol4'},
{header:'Test Col5', dataIndex:'testCol5'},
]
}


JSON Response:


{
"results":2,
"success":true,
"rows":[
{
"testCol1":"TC1R1-Data1",
"testCol2":["TC2R1-Data2a","TC2R1-Data2b","TC2R1-Data2c"],
"testCol3":"TC3R1-Data3",
"testCol4":"TC4R1-Data4,
"testCol5":"TC5R1-Data5",
},
{
"testCol1":"TC1R2-Data1",
"testCol2":["TC2R2-Data2a","TC2R2-Data2b","TC2R2-Data2c"],
"testCol3":"TC3R2-Data3",
"testCol4":"TC4R2-Data4,
"testCol5":"TC5R2-Data5",
},
]
}


Currently the cell that should be displaying the combobox shows all the comma seperated data, and i would like it to show one item then show the rest when triggered.

Thanks in advanced for any help,

UGA_Zimma

UGA_Zimma
19 Nov 2009, 10:23 AM
Anyone have any ideas about this?

Thanks,

UGA_Zimma

mschwartz
20 Nov 2009, 12:36 PM
["TC2R1-Data2a","TC2R1-Data2b","TC2R1-Data2c"]

There's your store.

Literally.

store: response.rows[0], // = ["TC2R1-Data2a","TC2R1-Data2b","TC2R1-Data2c"]

UGA_Zimma
20 Nov 2009, 12:47 PM
Thanks for the reply.

Now its telling me that response is undefined. I guess this is because its in a column definition part, and there is no function(... , response, ...).

Any thoughts?

Thanks,

UGA_Zimma

mschwartz
20 Nov 2009, 1:19 PM
You posted "JSON Response" above

I don't know what variable you stored it in.

If it's a string, you need to Ext.decode() on it

mschwartz
20 Nov 2009, 1:22 PM
Maybe someone else can help you better...

UGA_Zimma
20 Nov 2009, 1:38 PM
Thanks for the help.