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: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon
Accepted Solution

ListView Title Showing but not Status - Why?

[ Edited ]

Hello.

 

So I'm using a GroupDataModel and DataSource to point to an .xml for a ListView. The title is showing but not the status. Is there something wrong in the code?

 

                        ListView {
                            visible: segmentedDrivers.selectedOption != biography
                            preferredHeight: 1270.0
                            minHeight: 1270.0
                            maxHeight: 1270.0
                            topPadding: 30.0
                            leftPadding: 30.0
                            rightPadding: 30.0
                            bottomPadding: 30.0
                            dataModel: dataModel
                            listItemComponents: [
                                ListItemComponent {
                                    type: "listItem"
                                    StandardListItem {
                                        title: ListItemData.statTitle
                                        status: ListItemData.statValue
                                    }
                                }
                            ]
                        }
                        attachedObjects: [
                            GroupDataModel {
                                id: dataModel
                                grouping: ItemGrouping.None
                            },
                            DataSource {
                                id: driverStatsURL
                                query: "/vetstats/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"
                            }
                        ]

 

Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

For this, statTitle and statValue are just two attributes in each xml element. I don't understand why just statTitle is working but statValue doesn't show with the status. Even if I use it as a description. How is only the title working?

 

StandardListItem {
                                        title: ListItemData.statTitle
                                        status: ListItemData.statValue
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ListView Title Showing but not Status - Why?

If you assign ListItemData.statTitle to status does it appear?
Please show the XML.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

I can try assigning ListItemData.statTitle to the status later this afternoon. But in the meantime, here is the XML

 

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

 

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

Re: ListView Title Showing but not Status - Why?

If you can change the XML file try moving the items to second level:

<vetstats>
<header>
<listItem ...

If that will not help try dumping dataModel.data() so we can see what format it was converted into.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

[ Edited ]

So Zmey, I tried a few things you asked. Setting title: ListItemData.statTitle like you mentioned in your first post to status: ListItemData.statTitle still actually shows the .XML data as the title for each list item. I just can't seem to add any of the other XML attribute data to description, status, etc. There is always only a title for this specific list.

 

Also, the second level items in the .Xml idea didn't work. Everything in the list stayed blank, and I did update to query: "vetstats/header/listItem". So since none of that worked, I am back to where I had at least the title working. I just need the status to work still.

 

// 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
                            topPadding: 30.0
                            leftPadding: 30.0
                            rightPadding: 30.0
                            bottomPadding: 30.0
                            dataModel: dataModel
                            listItemComponents: [
                                ListItemComponent {
                                    type: "listItem"
                                    StandardListItem {
                                        title: ListItemData.statTitle
                                        status: ListItemData.statValue
                                    }
                                }
                            ]
                        }
                        attachedObjects: [
                            GroupDataModel {
                                id: dataModel
                                grouping: ItemGrouping.None
                            },
                            DataSource {
                                id: driverStatsURL
                                query: "/vetstats/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

 XML

<vetstats>
	<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"/>
</vetstats>

 

Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

Sorry to bump this up, but does anyone know a solution for this?

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

Re: ListView Title Showing but not Status - Why?

 

XML differs from the first one you posted.
Is is "statNumbers" or "statValue"?

 

If I understood correctly, when you set
status: ListItemData.statTitle (or any other value)

status text isn't shown at all no matter what you set?

 

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

Oh, shoot you're right. There is an inconsistency there. I will try to match them.

 

For the second question, correct, I haven't been able to get the status or description to work. Only titles show. But I don't understand why the title would work and none of the other attributes.

 

Of course the inconsistency in statNumbers and statValue would cause that but I think they were the same before and it still didn't work. But I will make them the same again and try a few of the things we discussed, then report back. It would be really great if I could get this to work as it's holding me up from submitting my app by the deadline.

Developer
Posts: 148
Registered: ‎10-30-2010
My Device: Bold 9930
My Carrier: Verizon

Re: ListView Title Showing but not Status - Why?

So now this is what I have and it still does not work

 

// 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
                            topPadding: 30.0
                            leftPadding: 30.0
                            rightPadding: 30.0
                            bottomPadding: 30.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/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>
	<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"/>
</vetstats>