Skip to Content

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 06, 2016 at 10:16 AM

    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.

    Add comment
    10|10000 characters needed 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.