Reputation: 1750
In a ext grid, I have a editor of a column as a textfield. The column datatype is datecolumn(I need this for time). I need to format the value from the column to the editor textfield as H:i
here is my code
xtype: 'datecolumn',
editor: {
xtype: 'textfield'
},
dateFormat: 'H:i',
renderer: function (val){
if (Ext.isDate(val)) {
return Ext.util.Format.date(val, 'H:i');
}
return val;
}
I already tried setting renderer for the textfield, and also adding listeners. also tried in the beforeedit method, but no success.
Any tips?
Upvotes: 1
Views: 896
Reputation: 4047
Your editor should be a datefield
and you should use the format
config for both the column and the editor field. There's no need to set a custom renderer function.
{
xtype: 'datecolumn',
format: 'H:i'
editor: {
xtype: 'datefield',
format: 'H:i'
}
}
Upvotes: 3