PDA

View Full Version : customize each cell of grid



andryi
5 Nov 2009, 7:23 AM
Hi all, I've got a question how can I customize each cell of one column in my grid, I mean if I want in the rowindex = 9, in the column called ("Value"), appears in the grid, a combo, and in the row index = 10, in the same column, appears a datefield, but I don'T use propertygrid just Editorgrid, can anybody help me??

pd: this is my code



var sp_GridColumns = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header: '', dataIndex: 'ConfigurationId', hidden: true},
{header: 'NameForUser', dataIndex: 'NameForUser', width: 250, sortable: true},
{header: 'Value', dataIndex: 'Value', width: 410, sortable: true, editor: new Ext.form.TextField({selectOnFocus: true})}
]);
sp_GridColumns.defaultSortable = true;


by default is textfield, but in some rows should be combos or datapicker or colormenus


I try with this, but is incorrect



Value.isCellEditable = function(colIndex, rowIndex){
if (rowIndex==9){
alert(rowIndex)
var colorMenu = new Ext.menu.ColorMenu({
handler: function(cm, color){
Ext.example.msg('Color Selected', 'You chose {0}.', color);
editor: new Ext.form.TextField.setValue(color)
}
});
}
else {
alert(rowIndex)
editor: new Ext.form.TextField({selectOnFocus: true})
}
return true;
}

where "Value is the name of the column", where I try to put the control type