Validate a single cell in datatable

I’m trying to validate a single cell in my datatable. The basics of my implementation looks like this:

onAfterEditStop:function(state, editor) {
if (this.validate(editor.row)) {
// validated
}
}

This code validates all the cells in a row but I would like it to only validate the cell that was edited. Can someone explain to me how to accomplish this?

Thanks
-nate-

Hello nate,

The validate() method for data components is implemented in the following way:

  • no argument - the whole component data is validated;
  • item ID as an argument - the whole item data is validated (here: datatable row with the given ID).

So if there’s invalid data in any cell of a datatable row, it will be highlighted as invalid and the cell with invalid data will be additionally marked.

To to achieve per-cell validation and marking you should provide custom logic, like this: http://webix.com/snippet/12b86744

(Cell styling can be studied on this sample: http://docs.webix.com/samples/15_datatable/21_styling/03_cell_styling.html)

Or, alternatively, you can make use of methods described in the following samples: