Integrating Ext.grid.panel validation and Ext.data.Model.validations

随声附和 提交于 2019-12-22 18:08:34

问题


I've been learning ExtJS4 after having done quite a bit of dev in ExtJS3. I'm quite intrigued by the new class Ext.data.Models, but I would love to integrate these validations with the validation function in Ext.grid.Panel.

Can anyone point me in the direction of any examples of using the validations property of Ext.data.Model in a Grid panel?

I've tried adding the validations to the model and putting invalid values in the grid, but it doesn't seem to throw an errors or the normal red lines.

Any ideas?


回答1:


Model validation against grid data is not supported out of the box currently.

Here is a working extension for model validation against form fields though.

And here is an incomplete attempt for model validation against a grid (what you were going for).




回答2:


@Drew

The grid provides RowEditing and CellEditing plugins for row/cell editing. In the background these plugins use Form panel for the validation of the input. So, you can use the form panel extension that @Geronimo has mentioned along with the extensions of RowEditing and CellEditing classes and use them in your grid to validate the data entered in the grid against the model associated with the row. And since, the validate() method is on a model, which can be used to validate a complete row data or a particular cell data. In case you are looking for bulk validation, you can override the sync() method of the Ext.data.Store class to achieve that.



来源:https://stackoverflow.com/questions/8737562/integrating-ext-grid-panel-validation-and-ext-data-model-validations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!