Skip to Content
0

Problem in destroying table data in SAP UI5 - Routing

Jun 21, 2017 at 04:19 PM

46

avatar image

I have a split app screen with two master and two detail screen. I have a table in 1st Detail Page. After pressing a button in 1st detail page, I am navigating to second detail page. Here I am doing some actions. But when I navigate from 2nd detail page to 1st detail page(which contains table), table data is not destroying. I tried .setData(null). but still data is there. Kindly suggest some ideas.

Second Detail Page controller code:

onNavBack : function()

{

var oTable = sap.ui.getCore().byId("__xmlview0--idDetail--prodTable").getModel(); oTable.setData(null);

this.getRouter().navTo("firstDeatilPage",true);

}

First Detail Page controller code:

onInit() method:

{

this.getRouter().getRoute("Detail").attachPatternMatched(this._handleRouteMatched, this);

}

_handleRouteMatched ()

{

// odata service call and data binding happens here. //

}

So when I navigate from second detail screen to first detail screen, the above _handleRouteMatched is called.


Note: I am using Routing for navigation

Regards

Karthik S

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sharath M G Jun 22, 2017 at 02:13 AM
0

Get handler to table through - this.getView().byId("idDetail--prodTable").

Then, try the method - destroyRows. This should remove all the rows in the table.

Set the debugger in console before the line to destroy and check if the data is actually getting removed.

Should work.

Regards,

Sharath

Share
10 |10000 characters needed characters left characters exceeded
Vivek Kumar
Jun 23, 2017 at 08:14 AM
0

Please use JSONModel binding for the table and set blank array to the JsonModel model when you navigate back to the 1st detail page.

Share
10 |10000 characters needed characters left characters exceeded