Hi Team,
Kindly advice on how to block the mulitiple fixed filter as attached .
Regards,
Sethuraghav N
Like
Hello,
Can you please specify your business task?
Do you want to prevent users from adding multiple single filters on the page?
Best regards,
Bogdan
Yes Bogdan Spasibov, we need to restrict user in adding the multiple filters in a calendar page. Only one filter should be selected at a time.
HI SathishKumar,
There is the option to change filter behavior; however, Creatio R&D team highly disrecommend you implementing such a filter and can provide only theoretical instructions.
Firstly, please note that the filter you've mentioned is implemented as an old module functioning through the whole system, not the Activity/Calendar section only. Thus, to avoid affecting all filters of your platform, you need to create your custom one and call it from the replacing client schema module.
The main filter loader is located at the "BaseDataView", the "loadFiltersModule" method. You need to replace the "ActivitySectionV2" and write there your own "loadFiltersModule" method that will re-write the original one from the "BaseDataView".
Then, please create a new module at the Configuration:
define("UsrixedFilterViewModelV2", ["FixedFilterViewModelV2"], function(fixedFilter) { function generate(config) { var result = fixedFilter.generate(config) result.methods.oldaddNonPeriodFilterValue = result.methods.addNonPeriodFilterValue; result.methods.addNonPeriodFilterValue = function (tag, simpleFilterValue) { var filters = this.get(this.getSelectedLookupValuesPropertyName(tag)); filters.clear(); this.oldaddNonPeriodFilterValue(tag, simpleFilterValue); }; return result; } return { generate: generate }; });
Below the detailed description step by step. The "fixedFilter" is the old model.
var result = fixedFilter.generate(config)
This code calls a standard out-of-the-box filter.
result.methods.oldaddNonPeriodFilterValue = result.methods.addNonPeriodFilterValue;
Here please write the logic you need:
result.methods.addNonPeriodFilterValue = function (tag, simpleFilterValue) { var filters = this.get(this.getSelectedLookupValuesPropertyName(tag)); filters.clear(); this.oldaddNonPeriodFilterValue(tag, simpleFilterValue); };
Regards,
Anastasiia