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: 20
Registered: ‎08-02-2012
My Device: -
My Carrier: SW Developer

Strange behaviour of ListView

Hi,

 

I have standard ListView with GroupDataModel. Title Label text is set by the last title from datamodel and then changed to correct title. There seems to be a bug in ListItemManager.

 

Console output:

text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Mum arrested for murder suicide jump with baby
text changed
text changed Top police chief charged for beating teen daughter
text changed Ikea to open 100 budget hotels across Europe
text changed South African 'hitman' denies killing Dewani
text changed Stockholm woman held for stabbing man
text changed Suspected bomb rocks Stockholm cinema
text changed Lithuania warns Belarus and summons envoy
text changed 'Assange asylum rumour is false': Ecuador
text changed Sweden 'less prepared' than Norway: report
text changed Teddy-drop team invites Lukashenko to Sweden


ListView {

id: feedListView
dataModel: feedModel
listItemComponents: [
ListItemComponent {
type: "header"
HeaderListItem {
title: ListItemData
}
},
ListItemComponent {
type: "item"
Container {
layout: StackLayout {
layoutDirection: LayoutDirection.LeftToRight
}
ImageView {
imageSource: "asset:///images/no_photo_big.jpg"

}
Label {

id: titleLabel
text: ListItemData.title
onTextChanged: {
console.log("text changed " + text)
}
}
}
}
]

}

 

Has anybody the same experience?

 

Jan

 

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Strange behaviour of ListView

What are you expecting?

What is feedModel?

 

If you expected fewer console messages? Perhaps wait for onCreateCompleted.

 

Stuart

Developer
Posts: 20
Registered: ‎08-02-2012
My Device: -
My Carrier: SW Developer

Re: Strange behaviour of ListView

feedModel is GroupDataModel containing data from database.In my case, feedModel contains 10 items. I m just curious why every list item data contains firtstly data from last item from model and then set again by correct data. Isn t it strange for you stuart?

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Strange behaviour of ListView

No, not strange at all.  I don't know the steps it takes during initialization, nor the number of times text changes.  It's even possible it's updating the text of a different one than you think it is, not just the text of the last one being applied.

Performance is not an issue: modern or even old machines can handle lots of work done constructing a UI without the user ever noticing.

 

Stuart