08-14-2012 09:54 AM
Hi,
I want to pass the values of a listItem to a sheet using the context menu but I cannot access the property variant from within the action item.
I have a listview and within the listView I am using StandardListItem.
Then within the StandardListItem I have defined my contextActions.
If I try to assign a value I receive the error: Error: Invalid write to global property "_contentView"
And if I try to use the property I receive the error: ReferenceError: Can't find variable: _contentView
Here is the relevent section of my QML.
NavigationPane {
id: navMain
property variant _contentView
Page {
id: projectsListPage
Container {
ListView {
objectName: "projectsList"
id: projectsList
// The data model used defined in the attachedObjects for the list.
dataModel: projectsModel
listItemComponents: [
ListItemComponent {
type: "item"
StandardListItem {
reserveImageSpace: false
title: {
ListItemData.name
}
contextActions: [
ActionSet {
title: ListItemData.name
ActionItem {
title: "View Details"
imageSource: "asset:///images/Edit.png"
onTriggered: {
var chosenItem = ListItemData;
_contentView = chosenItem;
console.debug("test: "+_contentView.createDate);
projectDetailsClicked( _contentView)
//editProjectSheet.visible = true;
}
}
There are no problems accessing the property variant from the listview signals such as onSelectionChanged so why not within the actionItem?
Your help is appreciated, Thx.
Solved! Go to Solution.
08-14-2012 10:16 AM
08-14-2012 01:01 PM
I get the following error: ReferenceError: Can't find variable: navMain
08-14-2012 02:10 PM
08-14-2012 04:02 PM
Hmm I just noticed this, I have this in my page's actionItem:
ActionItem {
id: songs
ActionBar.placement: ActionBarPlacement.OnBar
title: "Songs"
onTriggered: {
contextProperty.breakString(_contentView.notes);
}
}
and that works fine, it passes the contentView to the function, does that mean that I am infact accessing it in the way you need? Or is this different.