I have a requirement where a column has to be a combobox inside a grid.
1 st way inside items--
items :[{width : 500,
margin : '5 5 5 5',
xtype : 'gridpanel',
store :'some_store_name',
sortableColumns : false,
selType : 'cellmodel',
plugins : [ {
ptype : 'cellediting',
clicksToEdit : 1
} ],
columns : [ {
text : '<b>Column_one</b>',
dataIndex : 'index_one',
flex : 1
},
{text : '<b>choose a value</b>',
dataIndex : 'index_two',
flex : 1,
editor : {
xtype : 'combobox',
store : 'some_store_name',
queryMode : 'local',
displayField : 'label',
valueField : 'label'
}}]}]
This works in the right manner. The only problem is, the user has to click on the grid to to know that its a combo box. Should I use CSS and set a property saying that this particular column inside the grid should apper like a combo? Is there any other way?
2 nd way Instead of using the plugin editor, we can use a renderer function and return a xtype of combobox which is popullated by a store. If I have 3 columns inside a grid and the requirement says that this combo should be in the second column, then there is a bug. When I click on the combo ,select a value and move on to the third column to change a text or enter / edit the column which is of type (text box or some component), the combobox value disappears. Why is it so?
{ dataIndex : 'values', text : '<b>Status</b>', xtype : 'componentcolumn',
flex : 2,renderer : function(value) {return { name : 'some_name',store : 'some_store', value : value,xtype : 'combobox',displayField : 'y',valueField : 'x', queryMode : 'local'};}}}
Any suggestions are welcomed. thank you !