PDA

View Full Version : validation error immediately upon insert



billsalvucci
17 Oct 2012, 10:45 AM
I have the following column in a gridpanel



{
xtype: 'gridcolumn',
dataIndex: 'name',
tdCls: 'searchable',
text: 'Account',
editor: {
xtype: 'textfield',
validateOnBlur: false,
validateOnChange: false,
allowBlank: false
}
}


I am using a roweditor on the gridpanel


plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
ptype: 'rowediting',
pluginId: 'accountsRowEditingPlugin',
listeners: {
canceledit: {
fn: me.onGridroweditingpluginCanceledit,
scope: me
}
}
})
]


when I click my Add button whose handler is



var grid = Ext.ComponentManager.get('accounts');
var rowEditing = grid.getPlugin('accountsRowEditingPlugin');
rowEditing.cancelEdit();

var a = Ext.create('CrmApp.model.Account');

var store = Ext.getStore('AccountStore');
store.insert(0, a);

rowEditing.startEdit(0,0);


I immediately get a validation error dialog "the field is required", before the user is given a chance to enter anything.

Any idea why this is firing and how I can prevent it?

mitchellsimoens
19 Oct 2012, 8:01 AM
The RowEditor has a loadRecord method and in this method it checks to see if the form is valid and if it isn't then it will show the tooltip.

There is no config to prevent this, you would have to override this method.