marchalx
11 Oct 2012, 2:19 AM
Hello,
I'd like to create a grid with the first column of the grid which is editable (documents name for example).
Yet, i have a regular expression on this name (i'd like to ban forbidden caracters such as ' " etc).
With a regExp, all works, except in the case where i copy paste a string with forbidden characters, the string is copied without control... I tried to use Vtype but this is not working. Does anyone have a idea of how can i use vtype for an editable grid or another solution (event validate edit?)?
// Vtype for name filter.
Ext.apply(Ext.form.field.VTypes, {
onlyA: function(name) {
var onlyA = new RegExp('[a]');
return onlyA.test(name);
},
onlyAText: 'only A available'
});
// by having a mask in the editor, regExp works but not copy paste...
//var mask = new RegExp('[a]');
this.nameColumn = {
header : 'Name',
editor : {
//maskRe : mask,
allowBlank: false,
// this code does not work...
vtype: 'onlyA'
},
// this code does not work either...
//vtype: 'onlyA',
width : 130,
sortable : true,
menuDisabled :true,
dataIndex: 'name'
};
I'd like to create a grid with the first column of the grid which is editable (documents name for example).
Yet, i have a regular expression on this name (i'd like to ban forbidden caracters such as ' " etc).
With a regExp, all works, except in the case where i copy paste a string with forbidden characters, the string is copied without control... I tried to use Vtype but this is not working. Does anyone have a idea of how can i use vtype for an editable grid or another solution (event validate edit?)?
// Vtype for name filter.
Ext.apply(Ext.form.field.VTypes, {
onlyA: function(name) {
var onlyA = new RegExp('[a]');
return onlyA.test(name);
},
onlyAText: 'only A available'
});
// by having a mask in the editor, regExp works but not copy paste...
//var mask = new RegExp('[a]');
this.nameColumn = {
header : 'Name',
editor : {
//maskRe : mask,
allowBlank: false,
// this code does not work...
vtype: 'onlyA'
},
// this code does not work either...
//vtype: 'onlyA',
width : 130,
sortable : true,
menuDisabled :true,
dataIndex: 'name'
};