Main.view.xml:
<ObjectHeader
id="objectHeader"
title="{name}"
intro="{id}">
<headerContainer>
<IconTabBar
id="tabBar"
items="{
path: 'assigned',
parameters: {expand: 'b, c'}
}"
select="onTabBarSelect">
</IconTabBar>
</headerContainer>
</ObjectHeader>
Main.controller.js
onMasterSelectionChange : function (sPath) {
var oSource = oEvent.getParameter("listItem") || oEvent.getSource(),
// sPath = "/ASet('d')"
sPath = oSource.getBindingContext().getPath(),
oObjectHeader = this.byId("objectHeader");
oObjectHeader.bindElement(sPath);
this._oModel.attachEventOnce("requestCompleted", function(oEvent) {
var oTabBar = this.byId("TabBar");
oFirstListItem = oTabBar.getItems()[0],
sObjectId = oFirstListItem.getBindingContext().getProperty("id"),
sDPath = "/DSet('" + sObjectId + "')";
this._getControls(sDPath);
}, this);
}
I found a strange behavior: when I change the master list selection, sometimes Network will show a "/ASet/assigned" call, but sometimes there will be no call, which cause requestCompleted
not fired.
According to: SAPUI5 - bindElement doesn't work the second time,
If you call bindElement with the same path twice, the second time won't actually trigger a new call to get new data, since the path didn't change.
But I am sure it is different path. Is there any way that can trigger this call?
BTW
oObjectHeader.bindElement({
path : sPath,
events: {
change : function (oData, test) {
},
dataRequested : function (oData) {
},
dataReceived: function (oData) {
}
}
});
change
can be fired every time I click master list, but dataRequested
and dataReceived
is never called.
ODataContextBinding.prototype.
initialize
and see what's happening there (especially atbReloadNeeded
) – Boghyon HoffmannODataContextBinding
? And yes, it is a master-detail withexpand
. My aim is load the first master list item, and activate the first icon tab bar when page opens. – Tina Chen