cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.comp.filterbar.FilterBar - Binding refresh creates duplicates

seVladimirs
Active Contributor
0 Kudos

I'm facing weird behavior of sap.ui.comp.filterbar.FilterBar. When I'm trying to do "filterGroupItems" aggregation refresh - FilterBar trying to create aggregations instead of refreshing and of course fails due to duplicate IDs error.

See Code Snippet here - http://jsbin.com/vamemag/edit?html,output

1) Open dev console

2) Click on button "Filters"

3) Click on "Restore" button, it will try to refresh filterGroupItems.

Accepted Solutions (0)

Answers (1)

Answers (1)

NabiZamani
Contributor
0 Kudos

Hm, this looks like a bug to me. I have tried a few things, including switching to v2.ODataModel, setting templateShareable=false,... But all with the same result.

Furthermore, I have found out a few other interesting things:

  1. When unbinding the aggregation by calling oFb.unbindAggregation("filterGroupItems") the labels are removed but the input fields stay
  2. Even a rebind in JavaScript gives you an error:
    oFb.bindAggregation("filterGroupItems", {
    path : "/Employees", template: oFb.getBindingInfo("filterGroupItems").template, templateShareable : false
    });

Here is my jsbin code (based on yours). Just press the "live preview" arrow in jsbin and enter the code lines above into your console...

My assumption without checking the code is that the sap.ui.comp.filterbar.FilterBar is not completely supporting DataBinding which is very sad. I think it's absolutely worth opening a ticket for this.

seVladimirs
Active Contributor
0 Kudos

Yes, I spent time debugging it and also find the same - unbindAggregation is not removing input fields. Of course as a workaround we can destroy control and rebuild it completly, but this is not the right way of doing it.