Skip to Content
0

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

Dec 05, 2016 at 10:08 AM

131

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Nabi Zamani Dec 06, 2016 at 10:16 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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.

0