cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements Search Field extension

former_member435529
Participant
0 Kudos

Hi,

I need to remove some of the options under Define Conditions tab for a Search Help.

I read this should be done using the method setExcludeRangeOperations, but where exactly do I need to code this?. Is it in onInitSmartFilterBarExtension? and if so what is the control I need to run this method for?.

Thanks,

Javier

former_member435529
Participant
0 Kudos

Does anybody know why this code doesn't work?:

onInitSmartFilterBarExtension: function (oEvent) {

var oSmartFilterBar = oEvent.getSource();

oSmartFilterBar.getControlByKey("myfieldinsearchhelp").attachValueHelpRequest(this.onValueHelpRequest);

},

onValueHelpRequest: function (event) {

this.oValueHelpDialog = this.getId();

this.oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({

maxExcludeRanges: 0

});

var ValueHelpRangeOperation = sap.ui.comp.valuehelpdialog.ValueHelpRangeOperation;

this.oValueHelpDialog.setExcludeRangeOperations([ValueHelpRangeOperation.EQ], "string");

},

View Entire Topic
vvelinov
Product and Topic Expert
Product and Topic Expert
0 Kudos

You have not mentioned your UI5 version.

Here is a snippet that demonstrates how it should work and running on latest UI5.

https://jsfiddle.net/86forhdw/

Have in mind that you need these properties

supportRanges: true,
supportRangesOnly: true

So that Conditions tab is rendered.

Also you don’t need

maxExcludeRanges: 0

unless you want to remove the Exclude group of operators from the drop down. This is deprecated property that was useful with the old VHD design, before version 1.84. There it was possible to limit the number of exclude/include conditions separately. For instance you want to have only 5 include and 3 exclude. With the newer (current) design this is not possible, but you could limit the total number of conditions using maxConditions property.

And last but not least getControlByKey() is deprecated and should not be used. Manipulating directly the internal controls' instances of Smart Filter Bar from the application caused many problems with the logic of Smart Filter Bar and we had to discourage usage of this method. Yet, for the moment unfortunately we don’t provide such official API to configure the Value Help Dialog operators. But as we see the need for it, most probably would change that in futre. Just follow the What's new section of SAPUI5.

hope this helps,

Vladimir

former_member435529
Participant
0 Kudos
Hi Vladimir and thanks for your response!.
I am following that example but I think my requirement is slightly different:
The value help is coming from a field defined in CDS so I have not defined this input field in frontend.I need to modify the standard value help by removing some operations.
In ListReportExt.js file I attach the custom value help in the event below but nothing happens actually. Operations are the same and value help is not modified

onInitSmartFilterBarExtension: function (oEvent) {
var oSmartFilterBar = oEvent.getSource();oSmartFilterBar.getControlByKey("TorId").attachValueHelpRequest(this.onValueHelpRequest, this);
},
onValueHelpRequest: function (oEvent) {
this._oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({title: "Freight Orders",supportMultiselect: true,key: "TorId",descriptionKey: "DESCR",supportRanges: true,supportRangesOnly: false,maxIncludeRanges: 1,maxExcludeRanges: 0});
this._oValueHelpDialog.setIncludeRangeOperations([this.ValueHelpRangeOperation.Contains, this.ValueHelpRangeOperation.StartsWith, this.ValueHelpRangeOperation.EndsWith], "string");this._oValueHelpDialog.setExcludeRangeOperations([this.ValueHelpRangeOperation.Contains, this.ValueHelpRangeOperation.StartsWith, this.ValueHelpRangeOperation.EndsWith, this.ValueHelpRangeOperation.EQ], "string");
this.getView().addDependent(this._oValueHelpDialog);this._oValueHelpDialog.open();},