Home

RowEditing Plugin: validateedit event

Published on 6/25/2012


The rowediting plugin fires a validateedit event after its Update button is clicked.

It is fired before the record is populated with the form data.

Here is how to handle the validateedit event if you want to validate a model and show its validation errors:

The editor.editor.form reference is to a BasicForm and not a Form Panel.

validateedit: function(editor, e, eOpts){
    var newModel = e.record.copy(); //copy the old model
    newModel.set(e.newValues); //set the values from the editing plugin form

    var errors = newModel.validate(); //validate the new data
    if(!errors.isValid()){
      editor.editor.form.markInvalid(errors); //the double "editor" is correct
      return false; //prevent the editing plugin from closing
    }
}
... views