SAPUI5 Binding Context Path is Zero upon clicking a previously clicked row in flexible column layout

62 views Asked by At

I have developed a flexible column layout app. It works well except when I click on a row to navigate to second column and the page is refreshed, clicking the row same row again returns zero in the context path, e.g UnitSet(0) instead of UnitSet(709342). Correct display

When I click TECHNOLOGY the first time, the second column loads correctly with binding context well captured. If I refresh the page when second column is open and then click on TECHNOLOGY again, the binding context appears to be 'lost' and no data is displayed on the second column. See below Wrong display

Below is the navigation code that I am using:

unitEmployees: function (oEvent) {
var taskPath = oEvent.getSource().getBindingContext("odata").getPath(),
                task = taskPath.split("/").slice(-1).pop(),
                oNextUIState;
                    this.getOwnerComponent().getHelper().then(function (oHelper) {
                oNextUIState = oHelper.getNextUIState(1);
                this.oRouter.navTo("unitemployees", {
                    layout: fioriLibrary.LayoutType.TwoColumnsMidExpanded,
                    task: task
                });
            }.bind(this));
}

What could be the issue? My expectation is that if I click TECHNOLOGY after page reload, the path should not be UnitSet(0). Clicking INFRASTRUCTURE works perfectly as long as its first time before page reload. Regards, Dominic Gichuhi.

1

There are 1 answers

1
Dommy Gichuhi On

This issue was resolved by implementing get_entity.

When the page is refreshed while the second column is open, what is happening is the get_entity method is being executed to fetch a single record.

Considering the binding is two way, upon refresh, the previous context is lost and hence clicking on the same item to navigate returns an empty object in the second column. Implementing the get_entity method ensures that even after a page refresh, the context remains.

Regards,

Dominic