Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

How to get the id of elements from a selected row in a list item

Hi,


I have  a list item  with  a text element and a icon element. The text element idisplays the name of the months. The icon does not have any binding and it has a default value for src


On the press event of the list item , I am able to get the selected row and get the month text,

selectedRow = oEvent.oSource.getBindingContext();
Month = selectedRow.getProperty("ZLABEL");


I also want to access the icon element to be able to change its src. How can I acess the icon element within the item. Some tip would be helpful.



Thanks,
Kavitha





Hi Kavitha


The best option would be to also use a binding on the icon src property. Then you can change the model data and update the icon source.


Is that possible in your scenario ?


Regards

Ole Andre 

Hi Ole,


Thanks for you reply. My actual requirement is that I have a main list which contains a text element, a icon element and a sublist below the text element.On the press event of the main list item the sublist items will be displayed and the src for the  icon on the main list item will have to be changed to a down arrow. (Basically like a dropdown list from the main list.)


I tried having a binding for the icon src property and update it for every press on the main list item. But this causes a obvious flicker action everytime the model is updated, instead  of a smooth display. (appears like a page refresh)


So to avoid the ficker, I thought I could get a reference to the icon from the selected main list item and set the src property to have a smooth display using the below :


this.setSrc("sap-icon://navigation-up-arrow");


Is it possible to get the reference to the icon from the selected main list item.


Thanks

Kavitha


Hi Kavitha


I will try to reproduce your scenario to be able to develop a solution.


Can you show me a printscreen of the layout ? Would help.


Regards

Ole Andre 

Hi Ole,



Thanks for your reply. I managed to get the id of icon on the main list item using the below statement.


var icon = this.getContent()[0].mAggregations.items[1].mAggregations.items[1].mAggregations.items[0].getSrc();


  Using this I was able to drill down to the icon .


Thanks,

Kavitha

Login or Signup to post a comment