on 06-07-2017 12:26 PM
Hi,
I am using .bindElement to call getEntity from OData to bind my view. When the data available (because I get it before with getentityset ), it doesn't sent a request to OData. It is totally understandable since the extra call isn't needed and the data already present. But if it doesn't sent a request, dataReceived event doesn't get triggered. I can't call functions in dataReceived because I don't know whether it's gonna get triggered. I can't call functions after bindElement, because I don't know if the data is available or is the request completed. For example:
this.getView().bindElement({
path: sObjectPath,
events: {
dataRequested: function() {
oViewModel.setProperty("/busy", true);
},
dataReceived: function(oData) {
oViewModel.setProperty("/busy", false);
that.callSomething(); // I can't use this way. Because it doesn't called every time
}
}
});
this.callSomething(); // I can't use it this way. Because request might not be completed yet.
Is there an another event I can use? I couldn't find the event list which is called during and after bindElement. The API doesn't provide this information:
Or should I use a callback method? If yes which one?
And please provide the list of events for bindElemen if available. Or how can I reach them in API reference?
I did it like this:
this.getView().bindElement({
path: sObjectPath,
events: {
change:function(oEvent){
var oBndContext = that.getView().getElementBinding().getBoundContext();
if(oBndContext){
that._determineButtons();
}
},
dataRequested: function() {
oViewModel.setProperty("/busy", true);
},
dataReceived: function(oData) {
oViewModel.setProperty("/busy", false);
that._determineButtons();
}
}
});
I am leaving it here in case somebody else need it. If you have a better solution, please share.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Add the below code in your bindElement
change: function(){
this.getView().getElementBinding().refresh();
}.bind(this),
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.