on 11-21-2021 1:50 PM
Hi there,
I have a list page to show all the employees and when I click the first data, I can successfully get the odata with the right data, e.g employeeSet('001')
But when I pressed back to the list and select another employee, e.g employeeSet('002'), it's still referring to the first data, when I debugged, the ID already being called as '002'.
But the textbox still showing the 1st data (001), what should I do?
When I refresh the page manually, the 2nd data is appearing.
Here's my detail view and the controller
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml"
controllerName="app.employeeEmployee.controller.employee">
<App>
<pages>
<Page title="page">
<content>
<VBox width="100%" direction="Column" id="__vbox0">
<items>
<Text text="{Firstname}" id="__text0"/>
<Text text="{Lastname}" id="__text1"/>
</items>
</VBox>
</content>
</Page>
</pages>
</App>
</mvc:View><br>
onInit: function() {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.getRoute("employee").attachMatched(this._onRouteFound, this);
},
// Custom Method to bind the elements using the Event Arguments
_onRouteFound: function(oEvt) {
var oArgument = oEvt.getParameter("arguments");
var oView = this.getView();
oView.bindElement({
path: "/employeesSet('" + oArgument.Kodeemp + "')",
events: {
change: this._onBindingChange.bind(this),
dataRequested: function(oEvent) {
oView.setBusy(true);
},
dataReceived: function(oEvent) {
oView.setBusy(false);
}
}
});
},
_onBindingChange: function(oEvent) {
var oElementBinding = this.getView().getElementBinding();
// No data for the binding
if (oElementBinding && !oElementBinding.getBoundContext()) {
this.getRouter().getTargets().display("notFound");
}
}
Hi Samuel,
try attachRoutePatternMatched instead of attachMatched.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi this has been resolved, the model binding mode change into oneWay from Onetime
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.