PDA

View Full Version : combobox only displays empty lines in Grid



Rick.McIntosh
16 Mar 2012, 6:11 AM
I have a combox in a grid and when I click the roweditor and then the combo box display arrow I get a number of blank lines equal to the number of values in the combo box store. Not sure what I am doing wrong??

eg arrow clicked
drop down opens
blank lines are displayed
you can arrow down the lines but no text shows
when you select window closes but no text is displayed as a selection

Ext 4.0.7

ArrangerStore has a column of 'size' that combobox is used to select legal values for






{
xtype: 'gridpanel',
store: 'ArrangerStore',
height: 400,
title:'Detail Data',
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1
})
],
columns: [{
text: 'Size',
id: 'comboSize',
width: 150,
sortable: true,
dataIndex: 'size',
editor: {
xtype: 'combobox',
queryMode: 'local',
value: "standard",
store: Ext.create('Ext.data.Store',{
fields: ['size', 'display'],
data: [
["standard", "Standard"],
["small", "Small"],
["medium", "Medium"],
["large", "Large"],
["smallStem", "Small Stem"],
["mediumStem", "Medium Stem"],
["longStem", "Long Stem"]
]
}),
displayField: 'display',
valueField: 'size',
triggerAction: 'all',
typeAhead: true
},
},

skirtle
16 Mar 2012, 6:59 AM
Please use
tags when posting code. I've moved your thread to the ExtJS 4 Q&A forum.

You're using array data but not an array store.

The easiest way to create a combobox with inline data is to get rid of the displayField and valueField and just do this instead:

[CODE]store: [
['standard', 'Standard'],
...
]

If you want an explicit store then you can use:


store: {
fields: ['size', 'display'],
data: [
{size: 'standard', display: 'Standard'},
...
]
}

Rick.McIntosh
16 Mar 2012, 7:22 AM
Thanks:

That was the problem and by adding the tags for each record it now displays