I have a list grid which has two columns. Column A = min and column B = max. For each row, min must be greater than 0 but smaller than the “max” of the same column. Obviously, the “max” can be different in each column.
Is there a way to do a validator that uses the value of another cell in it’s rule?
There is a problem with the solution above. When calling setFieldError from within OnCellSaved (CellSavedHandler callback), the error is not shown to the user correctly. Here are my repro steps:
click in a cell
edit value to enter something invalid
press tab so that the CellSavedHandler is called
At that point, the cell displays the error message properly but as soon as I click on another error, the error message disapears.
Also note that calling any method on the CellSavedEvent object passed to onCellSaved throws an exception.
So, this overall strategy does not work properly. I tried to fix the problem for a few hours but I fell back on doing the validation when the user tries to apply the current form.
We hereby bless last night’s nightly as “beta 2.5”. You can now use it Kidding only serious, as we can’t really take the time to look into bug reports from older builds while all builds are still betas.
A manually set validation error is going to get cleared any time validation is rerun for that cell, and any time the record is successfully saved (since it must be valid to be saved). See setValidateByCell(), setSaveByCell() and related APIs, and think about the lifetime you want for your custom error. The simplest thing might be to re-run your validation over the whole grid (this one is presumably small) every time there’s a save, even if that’s on every cell transition.