PDA

View Full Version : ExtJs Combo selectedValue in roweditor



fatnjazzy
22 Oct 2010, 4:34 AM
Hi,
I am using roweditor and inside the row i have a combo.
in the grid, the combo column is the symbol_id (number).
how do i make the combo/grid understand that symbol_id 22 is actually 'EURUSD'.
and force the grid display EURUSD and not 22.
Thanks.
this is my store:




'displayField' : 'symbol'
,'valueField' : 'symbol_id'
,SimpleStore({
fields: ['symbol_id', 'symbol']
,data: [[22,'EURUSD'],[23,'EURGBP'],[50,'USDILS']]
})


22980

Condor
22 Oct 2010, 4:43 AM
Use this (http://www.sencha.com/forum/showthread.php?67488-3.x-Ext.grid.ComboColumn-amp-Ext.util.Format.comboRenderer).

fatnjazzy
22 Oct 2010, 7:32 PM
Thanks
Can you help me combine that in my code?
i am new in the area
please see below: renderer:"nothing yet!"
BTW this is coming from ajax.
please remember that this is a rowEditor and not a grid editor
Thanks



var data = [new Ext.grid.RowNumberer(),
{
sortable: true,
dataIndex: 'id',
header: "ID",
allowBlank: false,
id: id,
width: 50
},
{
sortable: true,
dataIndex: 'date',
header: 'Date',
width: 150,
dateFormat: "Y-m-d",
format: "n/j/Y",
groupRenderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: "datefield",
allowBlank: false
}
},
{
sortable: true,
dataIndex: 'pl',
header: "PL",
allowBlank: false,
width: 150,
editor: {
xtype: "textfield",
allowBlank: false
}
},
{
sortable: true,
dataIndex: 'sum_pl',
header: "PL Summary",
allowBlank: false,
width: 150,
editor: {
xtype: "textfield",
allowBlank: false
}
},
{
sortable: true,
dataIndex: 'symbol_id',
header: "Symbol",
renderer:"nothing yet!"
}

,
editor: {
xtype: "combo",
allowBlank: false,
fieldLabel: "available answers",
name: "answer",
anchor: "90%",
mode: "local",
typeAhead: false,
autocomplete: false,
emptyText: "Please select a symbol",
triggerAction: "all",
displayField: "symbol",
valueField: "symbol_id",
store: new Ext.data.SimpleStore({
fields: ['symbol_id', 'symbol'],
data: [
[22, 'EURUSD'],
[23, 'EURGBP'],
[50, 'USDILS']
]
})
}
},
{
sortable: true,
dataIndex: 'is_active',
header: "Active?",
width: 150,
editor: {
xtype: "checkbox"
}
}]

Condor
22 Oct 2010, 9:34 PM
That would be:

{
xtype: 'combocolumn',
sortable: true,
dataIndex: 'symbol_id',
header: "Symbol",
editor: {
xtype: "combo",
...
}
},

fatnjazzy
22 Oct 2010, 10:38 PM
Hi and thanks
I am getting:

grid.getColumnModel() is undefined
Line 113
ext-all-debug.js

Is that supported by the RowEditor?
Thanks again

Condor
22 Oct 2010, 10:50 PM
This shouldn't be a problem for a RowEditor...

Which Ext version are you using?

fatnjazzy
22 Oct 2010, 10:54 PM
3.2.1

Condor
22 Oct 2010, 10:58 PM
That can't be the correct line number for the error!

ps. You did include the code I linked to - otherwise 'combocolumn' is undefined.

fatnjazzy
22 Oct 2010, 11:14 PM
Sure i did include the code.
but sorry, this is the error:
Cls is not a constructor

Line 45550

the version is 3.2.1

Condor
23 Oct 2010, 11:11 PM
No, that error indicates that it doesn't know xtype:'combocolumn', so it seems you didn't include this (http://www.sencha.com/forum/showthread.php?67488-3.x-Ext.grid.ComboColumn-amp-Ext.util.Format.comboRenderer) correctly.

fatnjazzy
24 Oct 2010, 11:41 AM
Thanks,
Done!!!