Skip to Content
0
Oct 14, 2019 at 09:39 AM

back View 1 afters press button clear

31 Views

Hi,

Being a beginner in fiori webide, i cannot find a solution to my problem since few days. i explain: i created an app with 2 views ( view1 and view2); i can go through view1 to view2 but the reverse is not possible. I would like to go back to view1 after executing the button clear ( this button permits to delete items)

Manifest

	"routes": [{
				"name": "View1",
				"pattern": "View1",
				"target": ["View1"]
			}, {
				"name": "View2",
				"pattern": "View2",
				"titleTarget": "",
				"greedy": false,
				"target": "View2"
			
			}],
			"targets": {
				"View1": {
					"viewType": "XML",
					"transition": "slide",
					"clearControlAggregation": false,
					"viewId": "View1",
					"viewName": "View1",
					"viewLevel": 1
				},
				"View2": {
					"viewType": "XML",
					"viewName": "View2",
					"viewLevel": 2,
					"controlAggregation": "pages"
				}
				
				
				
			}
		}
	},
	"sap.platform.abap": {
		"uri": "/sap/bc/ui5_ui5/sap/z_inventory_gw/webapp",
		"_version": "1.1.0"
	}
}

Controller.JS

ClearBox: function () {
			var oView = this.getView();
			//var those = this;
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			var URL = "/sap/opu/odata/sap/ZPREPARE_FLUX_SRV/ItemsSet(Zfilter='T" + "07" + "')";
			var infoMsg = oView.getModel("i18n").getResourceBundle().getText("confirm_clear");
			MessageBox.confirm(infoMsg, {
				initialFocus: MessageBox.Action.CANCEL,
				onClose: function (sButton) {
					if (sButton === MessageBox.Action.OK) {
						//debugger;
						BusyIndicator.show();
						OData.read(URL, function (response) {
								BusyIndicator.hide();


								if (response.Message !== "" && response.EZtype === "O") {
									oView.byId("TOOL_BAR").setVisible(false);
									oView.byId("table1").setVisible(false);
									var model = new JSONModel();
									oRouter.navTo("View1, true");
									//debugger;
									//return;
									oView.setModel(model, "itemModel");
									MessageBox.show(response.Message, {
										icon: MessageBox.Icon.INFORMATION,
										//this._oRouter.navTo("View1", {});
										onClose: function () {
											jQuery.sap.delayedCall(500, this, function () {


												oView.byId("SearchArt").focus();


											});


										}
									});
								}
							},