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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
Hithredin
Posts: 344
Registered: ‎06-03-2010
My Carrier: Free
Accepted Solution

ListView recycling

Hi!

 

The ListView  seems to have a recycle system when scrolling

 

It has drawback, for exemple, if I have a checkbox on a cell, it is sometime already checked whereas I specifically set "checked=false" in the QML.

So it means that when the webview reuse a old cell, it sets all the data that depends of the DataModel, but not the default values.

 

Is this assumption true?

Do we have a signal or a workaround to reset default values of the cell?

 

Thanks

Please use plain text.
Developer
Dredvard
Posts: 154
Registered: ‎01-27-2012
My Carrier: Rogers

Re: ListView recycling

I use an ImageToggleButton and set my checked:true.  I've had no issues of it not working.  I've had many issues with it recycling images but haven't had any issues with the toggle button.

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.
Developer
kylefowler
Posts: 479
Registered: ‎05-17-2009
My Carrier: ATT

Re: ListView recycling

What are you using a webview for? You need to make sure the properties of the items have a reset property and a notify property so that when the new data is set on the cell that the qml rebinds.
Like all of my posts
Please use plain text.
Developer
Hithredin
Posts: 344
Registered: ‎06-03-2010
My Carrier: Free

Re: ListView recycling

I finally created the checkbox property to make it bind to the ListItem, even if it has no meaning for the data.

Please use plain text.
Developer
sketch34
Posts: 53
Registered: ‎05-23-2012
My Carrier: Developer

Re: ListView recycling

@

 

I'm having issues with ListView recycling ImageViews as well. Did you find a workaround?

----
I know exactly where the problem *might* be.
Please use plain text.
Developer
Hithredin
Posts: 344
Registered: ‎06-03-2010
My Carrier: Free

Re: ListView recycling

Could you open a post (and provide a link to it) which describe exactly the problem your are facing?

 

Please use plain text.
Developer
strobejb
Posts: 178
Registered: ‎10-15-2012
My Carrier: Orange

Re: ListView recycling

Try using property binding, rather than javascript assignments

Please use plain text.
Developer
sketch34
Posts: 53
Registered: ‎05-23-2012
My Carrier: Developer

Re: ListView recycling

I solved it with a bit of a hack/workaround here: http://supportforums.blackberry.com/t5/Cascades-Development/How-to-detect-when-ListView-recycles-an-...

----
I know exactly where the problem *might* be.
Please use plain text.
Developer
Hithredin
Posts: 344
Registered: ‎06-03-2010
My Carrier: Free

Re: ListView recycling

Update, use this:

 

ListItem.onDataChanged: {

 

}

Please use plain text.