Hi,
I bind a json model to sap.ui.core, as well as 2 initialed controls: sap.m.select & sap.m.MultiCombobox. The Latter needs to change the binding path everytime the former is selected.
My current solution:
var select= evt.getSource(); //sap.m.select var mcb = sap.ui.getCore().byId("mcb_train"); //sap.m.MultiCombobox var path = "/changedPath"; mcb .removeAggregation(); mcb .removeAllItems(); //can't leave out this, why ? mcb .bindAggregation("items", path,new sap.ui.core.Item({key:"{key}",text : "{text}"})); // train.rerender(); //no difference },
Result description:
When I select an item of sap.m.select, the data of sap.m.MultiCombobox can change and display correctly.
But If I check a box in the MultiCombobox before, then each time it changes path, the corresponding items will be checked in advance. It seems the attribute "selectedKeys" never change. And I can't clear it.
Further more, the text value won't change, too. It remains the value of the box I check in the first place, no matter what I check after that, it just won't change.
Here's my additional question:
1.What's the difference between removeAggregation() & unbindAggregation() & destroyAggregation() ? Do they work? Cause when I output mAggregation attribute in the console, it seems not change.
2.If I don't use removeAllItems(), then once I check a box in the MultiCombobox, then, after I select on the sap.m.select, the MultiCombobox won't be able to display any json data. Instead, it displays an item with text "no data". In console I can see the binding path doesn't change as requested. Why?
3.Is there any better realization?