cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Custom Control Multi-Combo Box drop down list in Smart filter Bar not updating

Former Member
0 Kudos

Hi Experts,

We are trying to create a custom control multi-combo box in a smart filter bar where the list of items are dependent from another filter (FilterA). FilterA is also found at the same smart filter bar and with Value help request. So the requirement is whenever FilterA is changed, the drop down list of the multi-combo box changes dynamically.

The problem is that the Value Help GetEntitySet method of the multi-combo box is triggered right away at first launch of the app and no longer calls the same GetEntitySet when FilterA is changed. This leaves the drop down list as empty or will only change values one time.

If anyone knows how to solve this issue, it would be of great help.

Thanks and Best Regards!

Mac

Accepted Solutions (1)

Accepted Solutions (1)

mvaibhav
Contributor

If i have understood your requirement correctly, the value in your multicombox box are actually dependent on value selected by user in Filter A. So you need to pass the value selected by user in Filter A to retrieve the expected values.

Try calling the entityset method of the MultiCombo Box on the filterChange event of the SmartFilterBar whenever you change the value of Filter A. Then you should get the updated values.

Former Member
0 Kudos

Thanks! It worked. Now the the entityset method of the MultiCombo Box is called whenever the value of Filter A is changed.

What happened now is I am getting a "No Data" in my MultiCombo Box. Found out that a 'blank' value of Filter A is passed to the entityset method of the MultiCombo Box. e.g. FilterA EQ ' '. I checked the filter string and select options and all the same having a blank value.

Sharing how we implemented:

filterChange event attached to smartfilterbar object

var oSFB = this.getView().byId("smartFilterBar");
oSFB.attachFilterChange(null, this.fchange, this);

Code for retrieving value from FilterA and passing it to Backend to be used as a where clause for retrieving MultiCombo Box values

fchange: function(oEvent){
   var aFilters = [];
   var oModel = this.getView().getModel();
   if(oEvent.getParameters().getParameters().id.indexOf("FilterA") !== -1){
    var FiltrA = oEvent.getParameters().getParameters().value;
    aFilters.push(new Filter("FilterA",sap.ui.model.FilterOperator.EQ,FiltrA));
    oModel.read(
             "/VH_MultiComboBox",
             {
              filters : aFilters,
              success : jQuery.proxy(this.fSuccess, this),
              error : jQuery.proxy(this.fErr, this)
            },
            this);
   }
   },<br>
mvaibhav
Contributor
0 Kudos

Hi Mac,

In the filterChange event, you can directly retrieve the data from the smart filter bar control and pass it to the backend.

if (oEvent.getParameters().getParameter("filterChangeReason") === "FilterA")
{
var filterData = oEvent.getSource().getFilterData();
if (filterData) {
	if (filterData.hasOwnProperty("FilterA")) {
		var FiltrA = filterData.FilterA;
              // Call you combo box service here
	     }
	}
}
Former Member
0 Kudos

Hi Vaibhav, we are able to retrieve it now. Found out that the filters are passed in the filter string variable and not to the select options internal table. This will be enough!

Thanks a lot for your inputs!

Answers (0)