Skip to Content

Routing issue while navigating back browser button

Hi All,

I am trying to implement Routing.

I have two views .In first view i have a table.When i click on table row then it navigates to other view and displays respective data,

Again when i click on Browser's back button it is navigating to the first view but the table is getting empty.

Could anybody please help em to solve this issue.

Regards,
Shekar.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 30, 2017 at 12:50 PM

    hi

    Try this;

    In manifest file or Component

    	"sap.ui5": {
    		"_version": "1.1.0",
    		"rootView": "zhr_a.view.App",
    		"dependencies": {
    			"minUI5Version": "1.30",
    			"libs": {
    				"sap.m": {}
    			}
    		},
    		"routing": {
    			"config": {
    				"routerClass": "sap.m.routing.Router",
    				"viewType": "XML",
    				"viewPath": "zhr_a.view",
    				"controlId": "app",
    				"controlAggregation": "pages",
    				"transition": "slide"
    			},
    			"routes": [
    				{
    					"name": "teamOverview",
    					"pattern": "",
    					"target": "teamOverview"
    				},
    				{
    					"name": "vertretungenn",
    					"pattern": "ErfassungVertretungen",
    					"target": "vertretungenn"
    				},
    		],
    			"targets": {
    				"teamOverview": {
    					"viewName": "TeamOverview",
    					"viewLevel": 1
    				},
    				"vertretungenn": {
    					"viewName": "ErfassungVertretungen",
    					"viewLevel": 2
    				},
    
    
    			}
    		},
    
    

    in first controller

    		onPressVertretungErfaasen: function() {
    
    
    			// Nav to ErfassungVertretung
    			this.getOwnerComponent().getRouter().navTo("vertretungenn");
    

    and to back

    	onBack: function() {
    
    			var sPreviousHash = History.getInstance().getPreviousHash();
    
    
    			//The history contains a previous entry
    			if (sPreviousHash !== undefined) {
    
    				window.history.go(-1);
    			} else {
    				// There is no history!
    				// replace the current hash with page 1 (will not add an history entry)
    				this.getOwnerComponent().getRouter().navTo("teamOverview", null, true);
    			}
    		},
    
    
    
    Add comment
    10|10000 characters needed characters exceeded