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
Zmey
Posts: 1,511
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: ListView Title Showing but not Status - Why?

Could it be the padding moving them out of the visible area?

Try commenting out everything from the layout. Seems it's the problem with display, not data source.

I have no more ideas. Sorry. :smileysad:

Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
urbanglowcam
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

[ Edited ]

I removed the padding. Also, I found out there were some caching issues with my web hosting. But now I pointed to a completely new .XML where the attribute names match up to status: ListItemData.statNumbers

 

What is strange now is that the status only shows now as the title, so just the numbers in statNumbers show up as the title, and statTitle does not show at all. It's as if it's taking the most recent property and using that as the title. This is so strange.

 

// Tabbed Pane project template
import bb.cascades 1.0
import bb.data 1.0

Page {
    property alias driverPhoto: driverPhotoURL.imageSource
    property alias driverBio: driverBioText.text
    property alias driverName: driverListInfo.title
    property alias driverTeam: driverListInfo.description
    property alias driverNumber: driverListInfo.status
    property alias driverFlag: driverListInfo.imageSource
    property alias driverStats: driverStatsURL.source
    Container {
        background: background.imagePaint
        layout: DockLayout {
        }
        ScrollView {
            Container {
                ImageView {
                    id: driverPhotoURL
                    scalingMethod: ScalingMethod.AspectFill
                    preferredHeight: 481.0
                }
                Container {
                    id: driverTitleContainer
                    leftPadding: 22.0
                    rightPadding: 22.0
                    StandardListItem {
                        id: driverListInfo
                    }
                }
                SegmentedControl {
                    id: segmentedDrivers
                    Option {
                        id: biography
                        text: "Biography"
                        value: "biography"
                        selected: true
                    }
                    Option {
                        id: statistics
                        text: "Statistics"
                        value: "statistics"
                    }
                }
                Container {
                    leftPadding: 22.0
                    rightPadding: 22.0
                    bottomPadding: 80.0
                    touchPropagationMode: TouchPropagationMode.None
                    Container {
                        id: contentContainer
                        background: back2.imagePaint
                        TextArea {
                            id: driverBioText
                            inputMode: TextAreaInputMode.Text
                            input.flags: TextInputFlag.SpellCheckOff
                            editable: false
                            visible: segmentedDrivers.selectedOption == biography
                            topPadding: 30.0
                            leftPadding: 30.0
                            rightPadding: 30.0
                            bottomPadding: 30.0
                        }
                        ListView {
                            visible: segmentedDrivers.selectedOption != biography
                            preferredHeight: 1270.0
                            minHeight: 1270.0
                            maxHeight: 1270.0
                            dataModel: dataModel
                            listItemComponents: [
                                ListItemComponent {
                                    type: "listItem"
                                    StandardListItem {
                                        title: ListItemData.statTitle
                                        status: ListItemData.statNumbers
                                    }
                                }
                            ]
                        }
                        attachedObjects: [
                            GroupDataModel {
                                id: dataModel
                                grouping: ItemGrouping.None
                            },
                            DataSource {
                                id: driverStatsURL
                                query: "/vetstats/header/listItem"
                                type: DataSourceType.Xml
                                onDataLoaded: {
                                    dataModel.insertList(data);
                                }
                                onSourceChanged: {
                                    driverStatsURL.load();
                                }
                            },
                            ImagePaintDefinition {
                                id: background
                                imageSource: "asset:///images/Tile_scribble_light_256x256.amd"
                                repeatPattern: RepeatPattern.XY
                            },
                            ImagePaintDefinition {
                                id: back2
                                imageSource: "asset:///images/ControlBorder.amd"
                            }
                        ]
                    } // End of Container
                } // End of Container
            } // End of Container
        } // End of Scroll View
    } // End of Container
}// End of Page

 

<vetstats>
<header>
	<listItem statTitle="Races" statNumbers="101"/>
	<listItem statTitle="Championships" statNumbers="3"/>
	<listItem statTitle="Wins" statNumbers="26"/>
	<listItem statTitle="Podiums" statNumbers="46"/>
	<listItem statTitle="Pole Position" statNumbers="36"/>
	<listItem statTitle="Fastest Lap" statNumbers="15"/>
	<listItem statTitle="Points" statNumbers="1054"/>
	</header>
</vetstats>

 

 

 Thank you so much Zmey for all that you can help me with. If you don't know what else can be done it's no problem. :smileyhappy:

Please use plain text.
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: ListView Title Showing but not Status - Why?

[ Edited ]

I've encountered a similar bug when using GroupDataModel. I think somehow the data isn't getting inserted into the data model correctly when calling insertList. I found it didn't matter which names I used in my StandardListItem definition, the first value was always the one showing. Switching to an ArrayDataModel and calling dataMode.insert(0, data) fixed the issue for me.

 

Edit: You may also need to remove the type from your ListItemComponent.

--------
Taylor Byrnes
Please use plain text.
Developer
urbanglowcam
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

The switch to ArrayDataModel from GroupDataModel, switching dataMode.insertList(data) to dataMode.insert(0,data) and removing the type from ListItemComponent did the trick!

 

I guess this can't be done in GroupDataModel. Thanks Taylor! :smileyhappy:

Please use plain text.