PDA

View Full Version : Editor grid panel with editable combo column



nityajs
30 Nov 2009, 6:34 AM
Hi All,

I have an issue with editorgrid panel of which one of the columns is editable combo. By default when grid loads the combo displays default value from the list as 'No'. When value is changed from 'No' to 'Yes' and clicked on some other part of the screen, combo list value is changed from 'Yes' to default value 'No'. I am unable to undertsand what is going wrong in my code.Any idea will be highly appreciated.

My code for combo.
[var cbReq = new Ext.form.ComboBox({
typeAhead : true,
triggerAction : 'all' ,
lazyRender :true,
mode : 'local' ,
store : new Ext.data.ArrayStore({
id: 0,
fields: [
'value' ,
'meaning'
],
data: [['N', 'No' ], ['Y', 'Yes' ],['M','Mandatory']]
}),
valueField : 'value' ,
displayField : 'meaning',
anchor :'95%'
});
]

Grid Column Model:
------------------


[
var toReqGridColumns = new Ext.grid.ColumnModel([
{header:"xx", id:'xx', width:75, sortable:true, dataIndex:'yy', hidden:true},
{header: "Required", id: 'newReq', width:125, sortable: false,
dataIndex:'newReq',editor:cbReq,renderer:Ext.util.Format.comboRenderer(cbReq)},
{header:"yy",id:'yy',width:125, sortable:false, dataIndex:xx'}])

]

Grid Code:
----------

var ToReqGrid = new Ext.grid.EditorGridPanel({
id : 'ToReqGrid',
store : ToReqDs,
singleSelect: true,
cm : toReqGridColumns,
selModel :new Ext.grid.RowSelectionModel(),
clicksToEdit:2,
viewConfig: { forceFit:false },
height : 205,
anchor : '100%',
title : 'New Grid',
border : true,
bbar : {}
});

-Nitya