selectFilter(filter: Object);
filter. Filter to be set as the current filter. This parameter contains the Filters field: that is, an array containing items of the PP.Mb.Ui.MetabaseObjectClass, enumeration, and the ResourceKe field that stores key of the resource required to get filter name
The selectFilter method sets specified filter as the current filter in a basic dialog box with repository.
To execute the example, the HTML page must contain the MetabaseDialogBase component named metabaseDialogBase (see. Example of creating the MetabaseDialogBase component). Remove all filters from the dialog box, next add a new filter and set it as the current one:
// Clear all filters from dialog box metabaseDialogBase.clearFiltersSet() for (var i = 0; i lt; metabaseDialogBase.getFiltersSet(); i++) { metabaseDialogBase.removeFilter(i); } console.log("Number of filters after clearing: " + metabaseDialogBase.getFiltersSet().length); // Create a filter to display regular reports var filter = { Filters: [2562], // Filter for regular reports // Resource key to get filter name ResourceKey: "openDialogReports" }; // Add the filter and select it as current metabaseDialogBase.addFilter(filter, 1, false); console.log("Number of filters after adding: " + metabaseDialogBase.getFiltersSet().length); // Select this filter as current metabaseDialogBase.selectFilter(filter); // Get current filter var currentFilter = metabaseDialogBase.getCurrentFilter(); console.log("Current filter: " + PP.resourceManager.getString(currentFilter.ResourceKey).Content);
After executing the example first all filters are removed from the dialog box, next a new filter that shows regular report is added and set as the current filter. Appropriate messages are shown in the browser console:
Number of filters after clearing: 0
Number of filters after adding: 1
Current filter: Regular reports
See also: