I’m designing a grid in ExtJs 4 that will represent a Map data structure. I have a custom cell editor for the key column in the grid. I want to enforce the fact that the key must be unique among all keys. How do I go about doing this?
At the moment I’m trying to set up a special textfield editor with a custom validator that checks if the user-submitted key value is unique by comparing it to the dataStore’s values. Unfortunately, this runs into the issue that the dataStore does not know what is the “current” record and so does not know which record to exclude when checking for duplicates.
^Confusing, right? That’s why I think I’m doing it wrong.
It’s a very good question, and I ended up doing pretty much exactly what you’re doing. In order to handle current record so I can exclude it from the lookup I added something like that to the
vtypevalidation function:One more note – if you will try to use same validator in the dialogs (as oppose to grid roweditor) – you will need to add more checks because
originalValuewill not be properly set always (at least I had to do this in 4.0.7 in my application).