Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 24
Registered: ‎04-04-2013
My Device: developer
My Carrier: non blackberry user

Accessing data from listview having arrayDatamodel inside onTriggered event

ListView

{

 id: city_list

 dataModel: ArrayDataModel{

 id: list_elements

 objectName: "city_name"

}

onTriggered: {

 city_button.text=_app.tr2(city_list.selected())

list_container.visible =false

}

 

 

This is my code of Listview. The data in arrayDataModel is inserted in C++ code .

When I click on any element in the list, inside ontriggered event it gives indexPath as  0.

How can i fetch the data which is clicked.

Highlighted
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Accessing data from listview having arrayDatamodel inside onTriggered event

I don't actually see indexPath in your sample code.

 

If I am intepreting your code correctly, something like this should work:

 

city_button.text = _app.tr2(city_list.dataModel.data(indexPath))

 

 

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker