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: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

HELP Serious ListView List Item Issues

I am really having trouble with List Items. I have my own custom list item. and it really behaves terrible. especially when new data comes in, the ListItemData behaves really bad for each list item. also when you scroll and scroll list item changes. is this a caching issue? Smiley Sad I really need a solution I have tried everything like removing all items in the list and data source then reload and still the same. Please.. Smiley Sad

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

Re: HELP Serious ListView List Item Issues

Hi! Please show the code. I'll try to guess:

if you're performing any initialization in Component.onCompleted in ListItemComponents, it won't work, because the components are reused during scrolling.

Also, do not change any values of controls inside of ListItemComponents directly (such as checkbox.checked etc). Bind them to fields in ListItemData, so they are updated properly when item reuse happens. Change their state by modifying data model.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

Re: HELP Serious ListView List Item Issues

[ Edited ]

I am very sorry I clicked the wrong Accept as Solution button isntead of reply. Smiley Sad

 

Here's Custom ListItem

http://pastebin.com/1rU6u7S3

 

Here's My Page with the ListView

http://pastebin.com/6aV7j62Y

 

The image view there is the one really terrible.

 

Also how can I modify the datamodel inside the custom listitem? or even outside?

 

I will also try your suggestions to bind them in the ListItemData instead of local variables,

Developer
Posts: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

Re: HELP Serious ListView List Item Issues

[ Edited ]

I tried changing a ListItemData.property value and doesn't change.

 

ListItemData.status = 2;

 

console.log("LIST ITEM STATUS: " + ListItemData.status);

 

and still outputs a different value. Smiley Sad

 

Similar Problem and solved here http://supportforums.blackberry.com/t5/Native-Development/How-to-dynamically-change-one-item-in-the-...

 

I will try.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: HELP Serious ListView List Item Issues

[ Edited ]

This often confuses the first-timer but the ListView is just for displaying data, changes must be done to the source data.

Take a look at this for a more thorough explanation...

 

http://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/

 

This may also be useful...

 

http://blackberrydevtraining.launchcontent.com/p/2472131409/DocumentViewRouter.ashx?Cust=24721&Docum...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 97
Registered: ‎11-13-2012
My Device: BB10 Simulator
My Carrier: Globe Telecom

Re: HELP Serious ListView List Item Issues

I've resolved my problem with modifying the data source directly. But would be really nice if we don't have to modify it and just modify the contents inside the list item. thanks so much everyone!

Highlighted
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: HELP Serious ListView List Item Issues

It just doesn't work that way in modern methodologies any more, this way to do it is common across most platforms now.

 

To not do it this way would risk the data and the view becoming unsynchronised.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.