cancel
Showing results for 
Search instead for 
Did you mean: 

sap.m.table: selectionchange event

Former Member
0 Kudos

Hi Experts,

I am using sap.m.table in my ui5 application and in that i am using selectionchange event which will navigate to another screen on click of table data (I am using columListItem and bind aggregation for binding).

The problem i am facing is when i come back to main screen and click on the table data again i am not able navigate to the screen again. I am using routing mechanism for navigating from one screen to another.

Kindly assist.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Varun,

Based on the description written above,

I feel the logic of your code is as below (please spare me for formatting errors)

SelectionChange:function(event){

var view = create new view with id 1  //********step 1

navigate to view with id 1

}

when you click first time on table row, it creates view with id 1 and navigate correctly.

Now agai nyou come back to previous view and again click on table row.

This time it tries to create view with same id again. which is causing error and you are not bale to navigate.

chekc F12 debugging tools, You cna see teh console error.

to avoid this use below logic

var page2 = null;

  page2 = sap.ui.getCore().byId("id1");

  if(page2 != null){

  }

  else{

  page2 = sap.ui.view({id:"id`", viewName:"demo.test", type:sap.ui.core.mvc.ViewType.JS});

  app.addPage(page2);

  }

  app.to(page2);

feel free to let me know in case your issue is different.

Regards,
Ajinkya

ugurkaya
Active Participant
0 Kudos

Hey Varun,

What is the problem for not being able to navigate again? Any error or something? Post your code please.