PDA

View Full Version : set a 'hour' mask in a Grid cell



Frederes
2 Sep 2009, 5:51 AM
Hello,

I have a Grid with an editable cell for displaying hours like 12:00 or 23:59
How to do to have the mask operate for this cell ?

Here is my sample code :

var cm = new Ext.grid.ColumnModel({
// specify any defaults for each column
defaults: {
sortable: false // columns are not sortable by default
},
columns: [
{
id: 'heure',
header: 'Horaire',
dataIndex: 'heure',
width: 55,
sortable: true,
resizable: false,
menuDisabled: true,
editor: new fm.TextField({
allowBlank: false,
maskRe: RegExp('[0-2][0-3][:][0-5][0-9]','g')
})
}
]
});

Thank you

Fred

Condor
2 Sep 2009, 5:57 AM
maskRe is only used to specify the valid characters.
You also need to specify the regexp config option to check the full string.


maskRe: /[0-9:]/,
regexp: /^[0-2][0-3]:[0-5][0-9]$/

Frederes
2 Sep 2009, 6:19 AM
Hi Condor,

First thanks for your fast response !
Done but now, i have a javascript error :

Erreur : c.isSelected is not a function
Fichier Source : http://127.0.0.1/misc.tv7.com/js/libs/extjs/ext-all.js
Ligne : 11

Thank for your help again,

Fred

Condor
2 Sep 2009, 6:32 AM
Use ext-all-debug.js for testing (line number 11 in ext-all.js isn't usable).

Also specify what you are doing when you get this error (post a stacktrace?).

Frederes
2 Sep 2009, 6:48 AM
It occurs when i try to edit the control