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
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red
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: 160
Registered: ‎01-27-2012
My Device: Playbook

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: 526
Registered: ‎05-17-2009
My Device: 9900

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: 404
Registered: ‎06-03-2010
My Device: Z10 Red

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: 54
Registered: ‎05-23-2012
My Device: 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: 404
Registered: ‎06-03-2010
My Device: Z10 Red

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: 282
Registered: ‎10-15-2012
My Device: bb10 developer

Re: ListView recycling

Try using property binding, rather than javascript assignments

Please use plain text.
Developer
sketch34
Posts: 54
Registered: ‎05-23-2012
My Device: 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: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: ListView recycling

Update, use this:

 

ListItem.onDataChanged: {

 

}

Please use plain text.