1
votes

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?

1
Don't you think for the datecolumn you need datefield editor ? - Damask
I need the editor to show the value in this format "H:i" - luca.p.alexandru
You can configure datefield format for displaying as well as you do it for datecolumn - Damask

1 Answers

3
votes

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'
    }
}