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: 134
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

How can I make an Infinite Loop in a Listview

[ Edited ]

Hello everybody.

 

 

I'm making a featured area based in a listview, but I would like to see it in a infinite scrolling (loop)

 

Someone could help me?

 

Regards!

Developer
Posts: 147
Registered: ‎05-31-2013
My Device: BlackBerry Z10 Limited Edition
My Carrier: Bonbon

Re: How can I make an Infinite Loop in a Listview

I don't think it's possible in a way that it seems smooth. Scroll to top and to bottom is the best it can do.

Developer
Posts: 47
Registered: ‎05-31-2013
My Device: Z10, Passport

Re: How can I make an Infinite Loop in a Listview

What about a custom picker? When using XmlDataModel you can choose to loop columns when scrolling. I think you can adjust below to fit your purposes.

import bb.cascades 1.2

Page {
    Container {
        Picker {
            id: updateIntervalPicker
            title: 'Update Interval'
            
            dataModel: XmlDataModel {
                source: "asset:///updateintervalmodel.xml"
            }
            
            pickerItemComponents: [
                PickerItemComponent {
                    id: hoursPIC
                    type: "hours"
                    content: Container {
                        layout: DockLayout {
                        }
                        Label {
                            id: hoursPIClabel
                            text: {
                                pickerItemData.text
                            }
                            verticalAlignment: VerticalAlignment.Center
                            horizontalAlignment: HorizontalAlignment.Center
                            
                            textStyle {
                                fontWeight: FontWeight.W400
                                base: SystemDefaults.TextStyles.SubtitleText
                            }
                        }
                    }
                },
                PickerItemComponent {
                    id: minutesPIC
                    type: "minutes"
                    content: Container {
                        layout: DockLayout {
                        }
                        
                        Label {
                            id: minutesPIClabel
                            text: {
                                pickerItemData.text
                            }
                            horizontalAlignment: HorizontalAlignment.Center
                            verticalAlignment: VerticalAlignment.Center
                            
                            textStyle {
                                fontWeight: FontWeight.W400
                                base: SystemDefaults.TextStyles.SubtitleText
                            }
                        }
                    }
                }
            ]

            kind: PickerKind.List
            preferredRowCount: 3
        }
    }
}

 

asset:///updateintervalmodel.xml

 

<updateinterval>
  <column loop="true">
    <hours text="0" value="0" />
    <hours text="1 Hour" value="1" />
    <hours text="2 Hours" value="2" />
    <hours text="3 Hours" value="3" />
  </column> 
  
  <column loop="true">
 	<minutes text="0" value="0" />
 	<minutes text="15 Minutes" value="15" />
 	<minutes text="30 Minutes" value="30" />
 	<minutes text="45 Minutes" value="45" />
  </column>
</updateinterval>

 

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How can I make an Infinite Loop in a Listview

Have a look at this video from a past BlackBerry Jam event that describes using infinite ListViews.

 

BlackBerry Jam Europe 2013 - JAM358 -- Infinite Lists in Cascades

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How can I make an Infinite Loop in a Listview

i have build some infinite lists, probably with code similar to the jam session as i got it explained by gerry klassen in Hong Kong.

Basically you watch the scrolling status of the listview, if it reaches a certain threshold you append new items to the datamodel (and remove old ones on the top) - or vice versa if scolling upwards.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter