Skip to Content
0
Aug 23, 2016 at 09:51 AM

Navigation issue on row press

46 Views

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.