Interactive GRID | Custom Validation API

Referred from John’s cookbook sample app.

Add Custom Validation to the Interactive Grid

  • Interactive Grid
  • Static ID – emp
  • Use SAL as column Name for below example.
  • JavaScript Code

var gridID = "emp";
var ig$ = apex.region(gridID).widget();
var grid = ig$.interactiveGrid("getViews","grid");
var model   = ig$.interactiveGrid("getViews","grid").model;
   
    model.forEach( function( record, index, id ) {
    var sal = model.getValue( record, "SAL" ),
        meta = model.getRecordMetadata( id );
    if ( sal > 2000 ) {
        model.setValidity("error", id, 'SAL', "Sal must be less than 2000.");
    }

});