I checked my detail2 controller, but unable to find the issue.. please find my detail2 controller.
| sap.ui.core.mvc.Controller.extend("zfin.view.Detail2", { | ||
| onInit : function ( ) { | ||
| this.oInitialLoadFinishedDeferred = jQuery.Deferred(); |
| if(sap.ui.Device.system.phone) { | |||
| //Do not wait for the master2 when in mobile phone resolution | |||
| this.oInitialLoadFinishedDeferred.resolve(); | |||
| } else { |
var oEventBus = this.getEventBus();
| oEventBus.subscribe("DETAIL", "LoadFinished", this.onMasterLoaded, this); | |||
| } |
| this.getRouter().attachRouteMatched(this.onRouteMatched, this); |
| }, |
| onMasterLoaded : function (sChannel, sEvent, oData) { | |||
| if(oData.oListItem){ | |||
| this.bindView(oData.oListItem.getBindingContext().getPath()); | |||
| this.oInitialLoadFinishedDeferred.resolve(); | |||
| } | |||
| }, |
| onRouteMatched : function(oEvent) { | ||
| var oParameters = oEvent.getParameters(); |
| jQuery.when(this.oInitialLoadFinishedDeferred).then(jQuery.proxy(function () { |
| // When navigating in the Detail page, update the binding context | |||
| if (oParameters.name === "detail2") { | |||
| var sEntityPath = "/" + oParameters.arguments.entity; | |||
| this.bindView(sEntityPath); | |||
| } |
else {
return;
}
| }, this)); | |||
| }, | |||
| showDetail : function(oItem) { | |||
| // If we're on a phone device, include nav in history | |||
| var bReplace = jQuery.device.is.phone ? false : true; | |||
| this.getRouter().navTo("detail2", { | |||
| from: "detail", | |||
| entity: oItem.getBindingContext().getPath().substr(1) | |||
| }, bReplace); | |||
| }, |
| bindView : function (sEntityPath) { | ||
| var oView = this.getView(); | ||
| oView.bindElement(sEntityPath); | ||
| // | Oview.byID("ITEMDetails").setModel(sEntityPath); |
| //Check if the data is already on the client | ||
| if(!oView.getModel().getData(sEntityPath)) { |
| // Check that the entity specified was found | ||||
| var oData = oView.getModel().getData(sEntityPath); | ||||
| if (!oData) { | ||||
| this.showEmptyView(); | ||||
| this.fireDetailNotFound(); | ||||
| } else { | ||||
| // this.getView().byId("idProductsTable").setModel(demoJSONModel); |
| // this.getView().byID("ITEMDetails").setModel(); | ||||
| this.fireDetailChanged(sEntityPath); | ||||
| } |
| } else { | |||
| this.fireDetailChanged(sEntityPath); | |||
| } |
| }, |
| showEmptyView : function () { | |||
| this.getRouter().myNavToWithoutHash({ | |||
| currentView : this.getView(), | |||
| targetViewName : "zfin.view.NotFound", | |||
| targetViewType : "XML" | |||
| }); | |||
| }, |
| fireDetailChanged : function (sEntityPath) { | ||
| this.getEventBus().publish("Detail2", "Changed", { sEntityPath : sEntityPath }); | ||
| }, |
| fireDetailNotFound : function () { | ||
| this.getEventBus().publish("Detail2", "NotFound"); | ||
| }, |
| onNavBack : function() { | ||
| // This is only relevant when running on phone devices | ||
| this.getRouter().myNavBack("main"); | ||
| }, |
| onDetailSelect : function(oEvent) { | |||
| sap.ui.core.UIComponent.getRouterFor(this).navTo("detail2",{ | |||
| entity : oEvent.getSource().getBindingContext().getPath().slice(1) | |||
| }, true); | |||
| }, | |||
| onSelect : function(oEvent) { | |||
| sap.ui.core.UIComponent.getRouterFor(this).navTo("detail2",{ | |||
| entity : oEvent.getSource().getBindingContext().getPath().slice(1) | |||
| }, true); | |||
| }, | |||
| // | onClick : function(oEvent) { | ||
| // | sap.ui.core.UIComponent.getRouterFor(this).navTo("detail",{ | ||
| // | entity : oEvent.getSource().getBindingContext().getPath().slice(1) | ||
| // | }, true); | ||
| // | }, | ||
| // | rowSelectionChanged: function(oControlEvent) |
// {
// var selectedRowContext = oControlEvent.getParameter("detail");
// // var link = oControlEvent.getSource().getBindingContext();
// // var fr = oControlEvent.getBindingContext();
// // var ctx = oControlEvent.getBindingContext();
// sap.m.alert(selectedRowContext);
// },
// onLineItemPressed: function(oEvent) {
// sap.ui.core.UIComponent.getRouterFor(this).navTo("detail2",{
| // | entity : oEvent.getSource().getBindingContext().getPath().slice(1) | ||
| // | }, true); |
// },
| getEventBus : function () { | ||
| return sap.ui.getCore().getEventBus(); | ||
| }, |
| getRouter : function () { | ||
| return sap.ui.core.UIComponent.getRouterFor(this); | ||
| } |
});