cancel
Showing results for 
Search instead for 
Did you mean: 

How to change/reduce the Filter operator list for value help dialog in smart Filter in UI5?

Hi,

I have a requirement where I need to change/modify the list of filter operators in the value help dialog of a selection field in the smart filter. Also, I don't want the "Exclude" option in the value help dialog.

Currently, I tried to remove the Filter operations in the initialise event of smart filter. I have to use the same code by which we can change the default operation of the field in the smart filter. But, even if I remove the filter operations in the token parser, it is kept on coming in the value help dialog.

Please find the code:

Please suggest any solution to achieve this requirement.

View Entire Topic
vvelinov
Product and Topic Expert
Product and Topic Expert

Hi @devanshpandey

looking at the screenshot I presume you use version prior 1.84, where we have two separate sections for include and exclude. This has changed since 1.84 as we have the two sections placed in one dropdown list. I think with the old design it's not really possible to completely remove Include/Exclude section.

But anyhow you can change the operators if you explicitly set them via those two methods (latest UI5 version docs)
https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.comp.valuehelpdialog.ValueHelpDialog%23methods/set...

https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.comp.valuehelpdialog.ValueHelpDialog%23methods/set...

So for string field if you want to set the exclude operators only to Contains, Starts and Ends you can do sotmething like this.

this._oValueHelpDialog.setExcludeRangeOperations([
						ValueHelpRangeOperation.Contains,
						ValueHelpRangeOperation.StartsWith,
						ValueHelpRangeOperation.EndsWith,
						
					], "string");

btw, similar question asked here

https://answers.sap.com/questions/13492376/smartfilterbar-how-to-customize-filter-operators.html?chi...

cheers,

Vladimir

SAPUI5

vvelinov
Product and Topic Expert
Product and Topic Expert

Ok you could try this, If you want to remove the Exclude section. When initalizing the value help set maxExcludeRanges to 0

onValueHelpRequested: function() {
					this._oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({
						title: "Product",
						...
						maxExcludeRanges:0
					});

and then supply empty list of operators

this._oValueHelpDialog.setExcludeRangeOperations([
					
					], "string");
mchlw
Discoverer
0 Kudos

Hi vladimir.velinov ,

Is there a possibility to change the Operations List via an odata annotation? In our case we have a SmartFilterBar and an annotated odata service. The value help dialog is generated by the given odata annotation information.

Is there another way to intercept the generation process?

Kind regards,

Michael

vvelinov
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @michael.zwick1,

unfortunately there is no such annotation that changes the operations list. In general they are adapted to the used data type, for instance for number you don't need 'Starts with' and in some rare cases need to be modified with the API that I cited already.

cheers,

Vladimir

SAPUI5

vvelinov
Product and Topic Expert
Product and Topic Expert
0 Kudos

I dug deeper here and discussed that with a team member. Turns out that we don't have legal way that you can call the APIs. Means that first you need to find the Value help dialog instance to call the API. Unfortunately we don't keep this instance after the dialog is closed. Means when you press the value help button we create the dialog and then when you close it we destroy it. To be able to change the operators list one has to hook to open event that is internal for the Smart filter bar. That unfortunately we don't support i.e. everything that is not annotated as public is considered private.

So at present, one can not change the operators list in the context of the Smart filter bar.

cheers,

Vladimir

SAPUI5

gregorw
Active Contributor
0 Kudos

Dear Vladimir,

thank you for the details. What could be the next step to get public API's for that requirement?

Best Regards
Gregor

former_member435529
Participant
0 Kudos

Hi Vladimir, How can I achieve that in the method onInitSmartFilterBarExtension of ListReportExt controller for a search field?.

Thanks,

Javier