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
Highlighted
Developer
Posts: 85
Registered: ‎06-22-2013
My Device: N/A
My Carrier: N/A

get the root element of a dataModel ?

Hello guys,

 

i need to get the first element or the root one from dataModel with out using (indexPath)


Label {
text: dataModel.data(dataModel.first()).name.toString()
}

Label {
text: dataModel.data(0).name.toString()
}

 

i have tried this but it dose no work ,how do i solve this please

Developer
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: get the root element of a dataModel ?

indexpaths work like this: [i,j]
Examples:
[3] - index path for the fourth child of the root item
[3,0] - index path for the first child of the fourth child of the root item
[] - index path for the root item (an empty array)

Also check out: https://developer.blackberry.com/native/documentation/cascades/ui/lists/list_view_selection.html
Don't forget to mark as solved and like my post if it helped out!