PDA

View Full Version : numberfield sends 0 when blank is entered for row editor in grid



w_goldman
17 Dec 2015, 2:25 PM
when blank is entered I want '' or null to be sent for myCol, not 0.

var gridColumns = {header: 'My Column',
dataIndex: 'myCol',
editor: {
xtype: 'numberfield',
allowBlank: true,
allowNegative: false
},
renderer: function(val){
if (val && val !== '0' && val !== '' && val !== ' ') {
return val;
}
return "";
}
}


var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', ...

var grid = Ext.create ('Ext.grid.Panel',{
modelClass: 'MyModel',
selType: 'rowmodel',
plugins: [ rowEditing ],
tbar: gridTb,
columns: gridColumns

w_goldman
17 Dec 2015, 2:59 PM
turned out my model needed to be a string for those attributes (was a number).