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: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry
Accepted Solution

How to use and add a tableview?

As mentioned on the subject,

 

Can anyone teach me how to add a tableview in qml? My purpose is just making a tableview with 100% width and height with 2 columns and each columns with buttons with 100% height and width. How can i achieve that?

 

Thank you.

Regards,

Steve Chan
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to use and add a tableview?

Hi, is table not exist in qml?
Regards,

Steve Chan
Developer
Posts: 107
Registered: ‎05-11-2011
My Device: BlackBerry Z10 LE
My Carrier: AirTel

Re: How to use and add a tableview?

hi you can use alternate way list view instead of table view with layout property to gridview.

 ListView {
    layout: GridListLayout {
             columnCount: 2
             cellAspectRatio: 2.50
          }

       }

 

Developer
Posts: 285
Registered: ‎08-06-2010
My Device: Z10

Re: How to use and add a tableview?

You can use a stack layout with space quotas:

 

    Container {
        id: tableViewContainer
        layout: StackLayout {
            orientation: LayoutOrientation.LeftToRight
        }
        horizontalAlignment: HorizontalAlignment.Fill
        Container {
            id: leftColumnContainer
            background: Color.create("#00ff00")
            horizontalAlignment: HorizontalAlignment.Fill
            layoutProperties: StackLayoutProperties {
                spaceQuota: 0.5
            }
            Label {
                text: "left"
                horizontalAlignment: HorizontalAlignment.Center
            }
        }
        Container {
            id: rightColumnContainer
            background: Color.create("#ff0000")
            horizontalAlignment: HorizontalAlignment.Fill
            layoutProperties: StackLayoutProperties {
                spaceQuota: 0.5

            }
            Label {
                text: "right"
                horizontalAlignment: HorizontalAlignment.Center
            }
        }
    }

 

 



Follow me on twitter @RileyGB - https://twitter.com/RileyGB
View my BB10 OpenSource projects - https://github.com/RileyGB/BlackBerry10-Samples
Developer
Posts: 79
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: How to use and add a tableview?

Thanks RileyGB. This really helped me. =)
Regards,

Steve Chan