ExtJS 2.x Grid Cell Validation for Duplicate Data

1.5k Views Asked by At

I have ExtJS Grid In which I have Columns called "Mobile Number". I have made simple thing here When I edit more than 2 rows and If I Modify the Column "Mobile Number" It will be checked whether is it Exist in Grid or Not.

If Duplicate Number found, I will give Message that the Input Mobile Number is already Exist and reloading the whole grid so all edited data will be gone.

But, I want the non-duplicate data back was edited.

So, How can I keep my non-duplicate data as it is after reload the whole Grid.

I just want to remove duplicate row where found duplication and other edited rows keep as it is.

Can I use this RowEditor plugin for ExtJS 2.x compatible.

http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/row-editor.html

My E-mail: [email protected]

2

There are 2 best solutions below

2
On

You should use a validator for the mobile number field that detects duplicates and refuse the duplicate number. So you don't have to reload the grid.

If you want to reload the grid anyways, you could get the dirty rows before doing so and store/reapply them afterwards.

To get the dirty records you can use the getModifiedRecords() function of the grids store. Use the commitChangesfunction of the store to apply them after validation/processing.

0
On

To find duplicate data use afteredit event of Ext.grid.EditorGridPanel on that event you will get current record, so just display message and add empty value in that field