cancel
Showing results for 
Search instead for 
Did you mean: 

Navigation issue on row press

hemchand_sharma
Active Participant
0 Kudos

Hi Experts,

i have an issue on row press navigation

My xml view code

<m:Table id="RosterTable" class="tableMargin"

  items="{

  path:'/Roster_InfoSet'}">

  <m:headerToolbar>

  <m:OverflowToolbar id="otbSubheader">

  <m:Link id="RosterNumberLink" text="Rosters" editable="false"

  class="advacedSearch" type="Emphasized" />

  <m:ToolbarSpacer />

  <m:OverflowToolbarButton icon="sap-icon://add"

  press="onAdd" />

  <m:OverflowToolbarButton icon="sap-icon://action-settings"

  press="onGroup" />

  </m:OverflowToolbar>

  </m:headerToolbar>

  <m:columns>

  <m:Column width="2em">

  <m:Text text="Roster ID" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="District" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="Union" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="Group" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="Class" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="Status" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text="Created/Changed" />

  </m:Column>

  <m:Column width="2em">

  <m:Text text=" " />

  </m:Column>

  </m:columns>

</m:Table>

I am doing row item binding in controller  bcz i found easy way to attach filter code in controller

RosterTable.bindItems("/Roster_InfoSet?$skip=0&$top=0&$filter=RosterId eq '"+RosterIdVal+"' and District1 eq '"+DistrictVal+"' and Union1 eq '"+UnionVal+"' and Group1 eq '"+GroupVal+"' and Class1 eq '"+ClassVal+"' " ,

  new sap.m.ColumnListItem({

  cells : [ new sap.m.Text({

  text: "{RosterId}"

  }), new sap.m.Text({

  text : "{District1}"

  }), new sap.m.Text({

  text : "{Union1}"

  }), new sap.m.Text({

  text : "{Group1}"

  }), new sap.m.Text({

  text : "{Class1}"

  }), new sap.m.Text({

  text : "{Status}"

  }), new sap.m.Text({

  text : "{ChangedDate}"

  }),

 

  ],

type: "Navigation",

  press: function(e){

  var context = e.getSource().getBindingContext();

  var path = context.getPath(); //"/collection/0"

  RosterID = context.getProperty().RosterId;

    dist = context.getProperty().District1;

  uni = context.getProperty().Union1;

  grp = context.getProperty().Group1;

  cls = context.getProperty().Class1;

  //var rankrule = context.getProperty().RankingRule;

  changedate = context.getProperty().ChangedDate;

  createdate = context.getProperty().CreatedDate;

  changeBy = context.getProperty().CreatedBy;

  createBy = context.getProperty().CreatedBy;

  status = context.getProperty().Status;

  var start = path.lastIndexOf('/') + 1;

this.getRouter().navTo("view_3" ,

  {

  rosterID:RosterID,

  district:dist,

  union:uni,

  group: grp,

     classVal:cls,

     //rankingRule:rankrule,

     changedon:changedate,

     createdon:createdate,

     createbyVal:createBy,

     chngBy:changeBy,

     status:status

   

  }

);

  }

  }));

issue i am getting is


Uncaught TypeError: this.getRouter is not a function

i have tried define getrouter every where withing that press function but not get result-   sap.ui.core.UIComponent.getRouterFor(this);

please help me out

Thanks in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

JoseMunoz
Active Participant
0 Kudos

The getRouter() method is in the component. So try with that if you are in the view controller:

this._oComponent = sap.ui.component(sap.ui.core.Component.getOwnerIdFor(this._oView));
this._oRouter = this._oComponent.getRouter();

Regards

hemchand_sharma
Active Participant
0 Kudos

Hi Jose,

thanks for reply but issue did nt get resolved .

above controller code is working fine with xml binding row press but not with while binding through controller .

my above  controller code is in some other press function of button from xml view

onGo : function(){---------------------------- onGo press button  use to filter value from input fields

my above controller code ;

}

due to this ... its not working i guess?

JoseMunoz
Active Participant
0 Kudos

Then you should check the walk walkthrough to see how routing is done:

SAPUI5 Explored

Regards

Answers (1)

Answers (1)

former_member203031
Contributor
0 Kudos

Hi Sharma,

Please make sure that viewPath names in the page which you want to navigate should be same.

check in the view and controller files.

I mean the name spaces how you defined in the component.js file.

Thanks,

Deepak.

Message was edited by: Deepak Anumula