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: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *
Accepted Solution

Simple horizontal listview in cascades

[ Edited ]

Hello,

I am trying to implement a simple horizontal listview in Container element which is a delegate of another listview. I did many tries but failed. Can someone help?

EDIT: I wrote the wrong code, I corrected it.

import bb.cascades 1.0
NavigationPane {
    id: nav
    Page {
        Container {
            ListView {
                dataModel: customModel
                listItemComponents: [
                    ListItemComponent {
                        Container {
                            ListView {
                                dataModel: XmlDataModel {
                                    source: "data.xml"
                                }
                                layout: StackListLayout {
                                    orientation: LayoutOrientation.LeftToRight
                                }
                                listItemComponents: [
                                    ListItemComponent {
                                        Label {
                                            text: ListItemData.item.name
                                        }
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        }
    }
}

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Simple horizontal listview in cascades

[ Edited ]

Can you describe how it's not working and what your expectations are?

 

You've also mentioned the word 'delegate' is this in your orginal code or are you not using the word in the Cascades sense?

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Simple horizontal listview in cascades

[ Edited ]

I can't find the thread any more that discussed this but a few months ago (for a laugh) I wrote a sample app putting a Listview (vertical) in to a ListView (horizontal) and ran in to horrible problems.  I haven't tested it since then on later APIs but in principle it worked then but peek and scrolling made it unusable.

 

You might like to reconsider your UI as a vertical listview within a horizontal one (and vice versa) has certain practical applications but a vertical within a vertical or a horizontal within a horizontal can probably be achieved in several different ways such as opening a new listview on clicking what is effectively a header list item or perhaps switching to a GroupModel?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: Simple horizontal listview in cascades

This is what I want:

I want vertical listview which delegate is a rectangle, this rectangle contains a horizontal listview (this listview don't need to be interactive).

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Simple horizontal listview in cascades

Okay having retested, the problems haven't gone away so how about just simply having a container in each Listitem which you add labels to (or if you need it slightly more complex a customcontrol)?

 

If it doesn't have to be interactive then don't bother with a second ListView


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: Simple horizontal listview in cascades

I wanted to use Cascades ListView because of animations ( I was thinking about scrollToItem() ). Now I want two labels in my container and need a simple movement animation between.How I can do this?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Simple horizontal listview in cascades

Can you close this thread off then as this is really a different question with a different answer.

In the new thread specify what animation you want to do and how the labels are positioned in the container.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: Simple horizontal listview in cascades

Ok, thank you for the help.