2013-09-18 16:09:00
Topic starter
Is there a built-in way for a report to require that one of the filters is entered without specifying any of them individually as required?
What I'm asking is, is there any default behavior that we have to require that the user input something into at least one of the filters?
If not, then I'm just going to extend One.Report or use a Report JS Listener class.
It is very easy to implement using report plugin js. It will something like below.
AIDN.LogicalInventoryPivotPlugin = Ext.extend(Object, {
init: function(report){
report.on({
formconfig: this.onFormConfig
,scope: this
});
}
,onFormConfig: function(report,formJson){
var validatePlugin = new One.form.FormValidatorPlugin({
validator: function(basicForm){
var allValues = basicForm.getValues();
/*At least one of the filters should be provided*/
if(!Ext.isEmpty(allValues['Undefined$Item']) || !Ext.isEmpty(allValues['Undefined$Program'])
|| !Ext.isEmpty(allValues['Undefined$ProductGroup']) || !Ext.isEmpty(allValues['Undefined$Site'])
|| !Ext.isEmpty(allValues['Undefined$SiteGroup']) || !Ext.isEmpty(allValues['Undefined$ItemClass'])) {
return;
}
return Labels.get('meta.error.AIDN.LogicalInventoryPivot.specifyOneFilter');
}
});
formJson.plugins = [validatePlugin];
}
});
No such core feature exists - JS Listener is probably the way to go.