PDA

View Full Version : Rest Proxy Example ignores validations



lfs2008
1 Mar 2012, 2:08 AM
Rest Proxy Example http://docs.sencha.com/ext-js/4-0/#!/example/restful/restful.html
Ext.grid.plugin.RowEditing ignores validations.
I can save non-valid and even empty values.
Why is it so?



Ext.define('Person',
{ extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int',
useNull: true },
'email', 'first', 'last'],
validations: [{ type: 'length',
field: 'email',
min: 1 },
{ type: 'length',
field: 'first',
min: 1 },
{ type: 'length',
field: 'last',
min: 1 }]}
);

tobiu
1 Mar 2012, 4:46 AM
the grid editing plugins only care for validations set on the editor fields. the validations on model level are not yet bound to any view and you can only check for them on model / record level like:



if (record.isValid()) {
record.save();
}

lfs2008
1 Mar 2012, 7:05 AM
http://www.diloc.de/blog/2011/05/05/extjs4-form-validation-via-model-binding/
(http://www.diloc.de/blog/2011/05/05/extjs4-form-validation-via-model-binding/)found fine decision here

lfs2008
2 Mar 2012, 12:25 AM
made my fix here

Issued fixed:

Model validation bound with Ext.grid.plugin.RowEditing (no empty fields allowed, email validation)
Error messages displayed properly
Only one new User form instance allowed
Delete button disabled in new User form


http://wap7.ru/folio/ext-restful-fix/restful.html