Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Navigation from Xml view not happening

$
0
0

Hi,

 

I am new to SAP UI5. While, developing sample application, I am facing below issue.

I am using the fragments for different section like footer,header, menu navigation contents.

In the menu navigation content fragment, using the ActionListItem to display all Menu items with eventCall on press.

<List><items>

<ActionListItem title="Menu1" press="handleListItem" />

<ActionListItem title="Menu2" press="handleListItem" />

<ActionListItem title="Menu3" press="handleListItem" />

</items></List>

 

handleListItem method is written View Controller as below.

 

handleListItem : function (evt)

{

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

     this.nav.to("Detail1",context);

}    

 

When I click on MenuItem during the runtime, the handleLsitItem method get invoked, checked through alert message.

However, nothing comes in Context variable and no further navigation.

 

My requirement, is to pass selected list item to javascript function, and set navigation to different view based on the selection.

But, passing the parameter to javascript function and invocation is not happening in xml view and corresponding navigation too.

 

i.e.

 

<List><items> 

<ActionListItem title="Menu1" press="handleListItem(event,1)"  />

<ActionListItem title="Menu2" press="handleListItem(event,2 )" />

<ActionListItem title="Menu3" press="handleListItem(event,3)"  />

</items></List>

 

and javascript function will be

 

 

handleListItem : function (evt,menu)

{

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

     if(menu==1)

          this.nav.to("Detail1",context);

     else if (menu==2)

               this.nav.to("Detail1",context);

}    

 

Please suggest me, if i can pass the parameter to javascript function invoke and navigation accordingly.

Sampel example will be good to compare.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>