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
Contributor
lichienmine
Posts: 34
Registered: ‎08-15-2013
My Device: Blackberry 10
My Carrier: XL
Accepted Solution

Swipe ListView Automatically

I want to make my Listview swipe automatically to the specific positon, i have try using scrollToPosition but its swipe to the end of listview, anybody know ?

Please use plain text.
Developer
Bluenoser
Posts: 257
Registered: ‎04-04-2012
My Device: BlackBerry Z10/Z10LE/Q10/PlayBook

Re: Swipe ListView Automatically

[ Edited ]

Do you know the exact position you want to swipe to?

 

I have used this to go to a specific location in a ListVIew for a GroupDataModel. You could adapt this to a swipe if that is what you want. It scrolls like a swipe.

 

var searchKeys = [ '1', '0000', ListItemData.name ];
// * Try and find the data in the favorites and get the QVariantList results
var indexLocation = coursesListItem.ListItem.view.dataModel.find(searchKeys);
// * If the QVariantList has no records, then add the modified data if (indexLocation.length < 1) { var favoriteListItem = ListItemData; favoriteListItem.type = '1'; favoriteListItem.distsort = '0000'; favoriteListItem.distance = ''; myListItem.ListItem.view.dataModel.insert(favoriteListItem); indexLocation = myListItem.ListItem.view.dataModel.find(searchKeys); myListItem.ListItem.view.scrollToItem(indexLocation); }

 

Please use plain text.
Contributor
lichienmine
Posts: 34
Registered: ‎08-15-2013
My Device: Blackberry 10
My Carrier: XL

Re: Swipe ListView Automatically

thanks for your answer, i have solve my problem with scrollToItem like this :
myList.scrollToItem([1])
Please use plain text.