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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
New Developer
georg
Posts: 66
Registered: ‎01-23-2009
My Carrier: O2
Accepted Solution

Remove items from ListView from a ContextAction in QML?

Is it possible to remove an list item in qml triggered from a context action? I have tried to do it in onTriggered signal of the ActionItem of the context actions set but it seems like I can't even access my ListView by its id.

Please use plain text.
Contributor
jkurtw
Posts: 29
Registered: ‎01-06-2013
My Carrier: Verizon

Re: Remove items from ListView from a ContextAction in QML?

[ Edited ]

I had the same problem. In my case, I only care about the depth, so I did this:

            onTriggered: {
                // item selection handler, write custom code here
                console.log("SELECTED path:" + indexPath)
                if(indexPath.length > 1) {
                        //Do something else
                } else {
                       navigationPane.pushLevel(indexPath)
                }
            }

 

Please use plain text.
Contributor
jkurtw
Posts: 29
Registered: ‎01-06-2013
My Carrier: Verizon

Re: Remove items from ListView from a ContextAction in QML?

And here is the complicated way:
"Using a Custom DataModel to Filter Data for a ListView" knowledge base article found here: http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-a-Custom-DataModel-to-Fi...
Please use plain text.
Contributor
lildeimos
Posts: 21
Registered: ‎05-21-2012
My Carrier: Wind

Re: Remove items from ListView from a ContextAction in QML?

Inside a list component should be possible to remove it by

 

myItemRoot.ListItem.view.dataModel.removeAt( myItemRoot.ListItem.indexPath );

 Inside the OnTriggered could be:

 

listView.dataModel.removeAt( indexPath );

 

Please use plain text.