Skip to Content

Navigation issue on row press

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 23, 2016 at 10:03 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 23, 2016 at 12:07 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.