Model validation before store sync

Listening on beforeSync event of store. Options parameter has hash of all records to be synchronized, broken down into create, update and destroy.

I need to validate them against their model validation rules.

Is it possible?

I tried this but it always returns true:

Ext.Array.forEach(options.create, function (item) {
    console.log(item.isValid());
});

Thanks


I've just realized that invalid records are not being inserted in hash of records to be synchronized (options parameter).

Instead I can iterate through store's items:

Ext.Array.forEach(st.data.items, function (item) {
    console.log(item.isValid())
} );
链接地址: http://www.djcxy.com/p/80024.html

上一篇: 同步存储后如何读取其他响应数据

下一篇: 商店同步前的模型验证