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
Highlighted
Developer
Posts: 64
Registered: ‎06-28-2011
My Device: BlackBerry Z10
My Carrier: Bell

List Won't Scroll All The Way Down

I have a list that is sorted alphabetically and on the right side of the list, in another container, another list containing the letters of those headers that when tapped, will bring the user to the beginning of each header. (tapping "E" brings you to all the items that begin with E."

 

However, when I select the last letter, for example "S", the list will scroll to the header for S but won't let me scroll to see the children. It's as if they don't exist.

 

Any help will be appreciated.

Developer
Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: List Won't Scroll All The Way Down

Do you have a code example?

I had massively issues when the listview is inside of a scrollview.
Developer
Posts: 64
Registered: ‎06-28-2011
My Device: BlackBerry Z10
My Carrier: Bell

Re: List Won't Scroll All The Way Down

[ Edited ]

It's probably sloppy and is contained in seperate QML files

 

 main.qml

Container {
                    background: Color.Gray
                    layout: StackLayout {
                        orientation: LayoutOrientation.LeftToRight

                    }
                    ListView {
                        id: blockList
                        layout: StackListLayout {
                            headerMode: ListHeaderMode.Sticky
                        }
                        dataModel: feedsDataModel
                        listItemComponents: [
                            ListItemComponent {
                                type: "item"
                                StandardListItem {
                                    title: ListItemData.name
                                    imageSource: "asset:///images/blocks/list/" + ListItemData.listImage
                                }
                            },
                            ListItemComponent {
                                type: "header"
                                Container {
                                    background: Color.DarkGray
                                    preferredWidth: 30.0
                                    Label {
                                        text: ListItemData
                                        touchPropagationMode: TouchPropagationMode.None
                                        horizontalAlignment: HorizontalAlignment.Center

                                    }
                                }
                            }
                        ]
                        onTriggered: {
                            var newPage = blockItem.createObject();
                            blocks.push(newPage);
                            var chosenItem = dataModel.data(indexPath);
                            _contentView = chosenItem;
                        }
                    }
                    BlockAlpha {

                    }
                }

 BlockAlpha.qml

import bb.cascades 1.0
import bb.data 1.0

Container {
    preferredWidth: 50
    ListView {
        dataModel: blockAlphaDataModel
        listItemComponents: [
            ListItemComponent {
                type: "item"
                AlphaItem {
                }
            }
        ]
        onTriggered: {
            var chosenItem = dataModel.data(indexPath);
            blockList.scrollToItem([ chosenItem.path ], ScrollAnimation.Default)
        }
        verticalAlignment: VerticalAlignment.Center
        horizontalAlignment: HorizontalAlignment.Center
    }
    attachedObjects: [
        GroupDataModel {
            id: blockAlphaDataModel
            sortingKeys: [ "name" ]
            grouping: ItemGrouping.None
        },
        DataSource {
            id: blockAlphaDataSource
            source: "alpha/blocksAlpha.xml"
            query: "/root/listItem"
            onDataLoaded: {
                blockAlphaDataModel.insertList(data);
            }
        }
    ]
    onCreationCompleted: {
        blockAlphaDataSource.load();
    }
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: HorizontalAlignment.Center
}