I already create tiles container and want to conditional routing to other page. if I click tiles1, I route to home, click tiles2, I route to page2. I want route by id click. How to I code in controller?
I already code but failed:
alert(oControlEvent.getParamaters("items"));
xml view:
<m:Panel>
<m:content>
<l:HorizontalLayout
id="TileContainerExpanded"
allowWrapping="true"
content="{/kepesertaan}">
<m:GenericTile class="sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout"
header="{header}" subheader="{subheader}" press="pressKepesertaan">
<m:tileContent>
<m:TileContent>
<m:content>
<m:ImageContent description="{id}" src="{icon}"/>
</m:content>
</m:TileContent>
</m:tileContent>
</m:GenericTile>
</l:HorizontalLayout>
</m:content>
</m:Panel>
How to solved this problem? Thanks all.
答案 0 :(得分:0)
这里我将如何解决它(假设我理解你的问题):
pressKepesertaan: function(oEvent){
var sPath = oEvent.getSource().getBindingContext().getPath();
var oModel = this.getView().getModel();
var oContext = oModel.getProperty(sPath);
this.getRouter().navTo(oContext.id); //navigate to route
}
Here就是一个例子。