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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Whats the best way to scroll through detail records linked to a listview,arraydatamodel?

Hi,

 

I have a listview and in the onTrigered signal handler I launch a detailpage passing it some info from the datamodel attached to the listview.   What I would like to do is allow the user to scroll to the next and prev record in the datamodel from within the detailpage being displayed.  currently the user needs to close the detailpage, and then select the next record of interest from within the listview which then once again sends the onTriggered() signal to the lisview which reopens the next detailpage..

 

Can someone suggest the best approach for handling this?

 

my current qml looks something like this:

 

Page {
       content: Container {
        layout: StackLayout {

        }
           Container {
            ListView {
                   id: searchListView
                dataModel: searchDataModel
                listItemComponents: [
                    ListItemComponent {
                        type: ""
                        SearchResultsListItem {
                            title: ListItemData.Title
                        }
                    }
                ]
                onTriggered: {
                    var feedItem = searchDataModel.data(indexPath);
                    var pagesecondPage = secondPage.createObject();
                    pagesecondPage.lblSearchAdViewHeader.text = feedItem.Title;
                    firstPage.parent.push(pagesecondPage);
                }

            }
        }

    }
    attachedObjects: [
        ComponentDefinition {
            id: secondPage

            Page {
                property alias lblSearchAdViewHeader: lblSearchAdViewHeader

                actions: [
                    ActionItem {
                        id: aiDisplayPrevAd
                        title: qsTr("Prev Ad")
                        
                        onTriggered: {
                            // This is where I would like to display the prev
                            // record in the listview
                            
                        }
                    },
                    ActionItem {
                        id: aiDisplayNextAd
                        title: qsTr("Next Ad")
                        
                        onTriggered: {
                            // This is where I would like to display the Next
                            // record in the listview
                            
                        }
                    }
                ]

                Container {
                         Label {
                            id: lblSearchAdViewHeader
                            text: "HEADER"
                         }
                }
            }
        },
        ArrayDataModel {
            id: searchDataModel
        },
        DataSource {
            id: searchDataSource
            type: DataSourceType.Json
            onDataLoaded: {
                //....
            }
            onError: {
                // .....
            }
        }
    ]
    
}

 

 

thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Whats the best way to scroll through detail records linked to a listview,arraydatamodel?

you could use the indexPath to load the next item into your detail view
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Re: Whats the best way to scroll through detail records linked to a listview,arraydatamodel?

Hi,

 

thanks, but from where? from within the ActionItem?



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Whats the best way to scroll through detail records linked to a listview,arraydatamodel?

yes, that would be one option.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Re: Whats the best way to scroll through detail records linked to a listview,arraydatamodel?

could you give me a sniplet or something...  how do I keep track of where I am in the listview,  also update the the listvew with the new postion ect.  i.e. is there an easy way to increase of decrease the current value of the indexPath by one?

 

thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!