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
Philipk
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook

Re: Modify to entryComponent.ListItem.indexPath?

        ListView {
            dataModel: myDataModel
            onTriggered: {
                //code here
            }
            listItemComponents: [
                ListItemComponent {
                    id: entryComponant
                    content: EntryContainer {
                        isHighlighted: ListItem.active || ListItem.selected
                    }
                }
            ]
            contextActions: [
                ActionSet {
                    ActionItem {
                        id: voteAction
                        title: "vote"
                        enabled: false
                        imageSource: "asset:///images/check.png"
                        onTriggered: {
			  console.log("index path = "+ entryComponant.ListItem.indexPath)
                        }
                    }
                }
            ]
        }

 

_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Modify to entryComponent.ListItem.indexPath?

Okay so there has been some mix-up in communication, initially you said you wanted to access the selectedItems from the ListItem but your ContextActions are defined at the ListView level not the ListItem level!

 

In this case you can just access through the selectionList() function of the ListView itself...

 

            ActionItem {
	       id: msaiCopy
                title: qsTr("Copy")
                enabled: false
                imageSource: "asset:///images/actions/copy.png"
	            onTriggered: {
	                var copied = folderModel.copyFolders(folderList.selectionList());
	                if (copied) {
	                    clearSelection();
	                }
	            }
            }

 

 

 


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

Developer of stokLocker, Sympatico and Super Sentences.