Notifications
Clear all

How do I add custom validation to an editable report?

1 Posts
1 Users
0 Likes
818 Views
0
Topic starter

I'd like to perform validation on one or more columns in the report's grid before the user updates the rows. How do I add that?

1 Answer
0
Topic starter

For ExtJS-based reports, you can use a report plugin which adds a custom validator to the grid's One.grid.GridErrorsPlugin instance. Here's a link to the documentation for the validator function.

define(function() {

Ext.ns('MOD');
MOD.ReportPlugin = {
  init: function (report) {
    report.on('gridcreated', function(_, grid) {
      report.gridErrors.validators.push(function(record) {
        // TODO
        
        return {
          message: 'Row-level error message'
          ,fields:[{
            name: 'Site$Name', message: 'Field-level error message'
          }]
        };
      });
    });
  }
};

});