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: 135
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Using navigationPane in onTriggered handler of contextMenu action click

Hey all,

It seems I am unable to push a page using navigationPane within the onTriggered handler of an ActionItem for a context menu. Here is some code...

 

ListView {
                objectName: "list"
                id: list
                listItemComponents: [
                    ListItemComponent {
                        id: listItemComp
                        FeedListItem {
                            id: feedListItem
                            contextActions: [
                                ActionSet {
                                    ActionItem {
                                        title: "ContextAction1"
                                        onTriggered: {
                                            var selectedItem = ListItemData;
                                            var page = feedDetailsView.createObject();
                                            //page.webUrl = selectedItem.permalink;
                                            page.pageTitle = selectedItem.title;
                                            navigationPane.push(page);
                                        }
                                    }
                                }
                            ]
                            attachedObjects: [
                                ComponentDefinition {
                                    id: feedDetailsView
                                    source: "FeedDetails.qml"
                                }
                            ]
                        }
                    }
                ]
                onTriggered: {
                    var selectedItem = dataModel.data(indexPath);
                    var page = webView.createObject();
                    page.pageTitle = selectedItem.title;
                    navigationPane.push(page);
                }
                attachedObjects: [
                    ComponentDefinition {
                        id: webView
                        source: "PostWebView.qml"
                    }
                ]
            }

 

When I click on a list item, it pushes the webView page just fine, however when I select the context action I have added to the list, nothing happens. Both onTriggered handler have almost identical code, except only one is working.

I put breakpoints in both handlers, and found that navigationPane in the onTriggered for context action click is null, whereas it is not for normal list click. How am I able to use navigationPane to push a view ontop of the stack, within the onTriggered handler for context action select?

 

Thanks!