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
Developer
Posts: 49
Registered: ‎05-02-2013
My Device: Z 10
My Carrier: airtel

Current Visible Item in a Listview

I just create a Horizontal List view with Images.

I want to know currently visible item.

How can i get it.

pls hel me.

 

Highlighted
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Current Visible Item in a Listview

ListScrollStateHandler class has firstVisibleItem property:

http://developer.blackberry.com/cascades/reference/bb__cascades__listscrollstatehandler.html#propert...

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 49
Registered: ‎05-02-2013
My Device: Z 10
My Carrier: airtel

Re: Current Visible Item in a Listview

Pls help me how to call the function    firstVisibleItem();

I am working in QML

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Current Visible Item in a Listview

 

Container {
    ListView {
... attachedObjects: [ ListScrollStateHandler { id: scrollStateHandler onFirstVisibleItemChanged: { // do something with firstVisibleItem } }
] }
// you can also bind to scrollStateHandler.firstVisibleItem
}

Use scrollStateHandler.firstVisibleItem like a regular indexPath. IndexPath is a JavaScript array consisting of section number and row number.

 


Andrey Fidrya, @zmeyc on twitter