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: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

ListView - Multi select and context menu

Hi,

 

I have an issue. Beside of I have already created an entry in the issue tracker.

 

If I set a context menu in my main container (so not in the ListView or ListItem) when I do a long press to show the menu... The items are unselected Smiley Sad

 

Also, I have a toggle button to switch in multi select mode, but the multi select mode doesn't seem work Smiley Sad

 

The issue is BBTEN-144. I have attached the project sample.

 

Nicolas 

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: ListView - Multi select and context menu

[ Edited ]

Hi,

 

I've checked your .zip file and made some tests here, it was missing to set the multiSelectHandler like the sample bellow, I added into your 2 buttons:

 

buttonID1:

 

listView.selectionMode = SelectionMode.Single;
listView.multiSelectHandler.active = false;

buttonID2:

 

listView.selectionMode = SelectionMode.Multi;
listView.multiSelectHandler.active = true;

Take a look at this, "if the multiSelectHandler is not active (i.e. MultiSelectHandler::active is false) the ListView will still behave as if it were in SelectionMode:: Single mode." from https://developer.blackberry.com/cascades/reference/bb__cascades__listview.html#selectionmode

 

There are more things that you can make with the multiSelectHandler, https://developer.blackberry.com/cascades/reference/bb__cascades__listview.html#multiselecthandler

 

One last thing that might help is the sample app BucketList, https://github.com/blackberry/Cascades-Samples/tree/master/bucketlist

 

Hope this helps.

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: ListView - Multi select and context menu

Indeed, you can enable the multi-select mode.

 

But, it isn't a good approch. When I click on "multi" button, I have the listview context menu shown and the menu bottom bar.

 

I want to only have the single or multi select mode ; then after selecting items (one or several), I want to the user can do a long press anywhere on the screen to show the global context menu.

 

Beside of, when I enable the multiSelectHandler, I can't show the global context menu !

 

Nicolas

 

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: ListView - Multi select and context menu

Actually, if you add the lines bellow on your contextActions, then you will have the ability to enable/disable the MultiSelect and you will keep with the contextMenu either, in fact, you will have another option on your contextMenu.

 

Anyway, you will need the multiSelectHandler { } proper set, and also, you may need different "behaviors" for the same action, I mean, you have to handle multi items selected. For instance, in this sample you sent, the "Break" action, will have to handle single and multi selection.

 

Please, have a try adding this into your contextActions:

 

multiSelectAction: MultiSelectActionItem {
    multiSelectHandler: listView.multiSelectHandler
    onTriggered: {
        multiSelectHandler.active = true
    }
}

 

Highlighted
Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: ListView - Multi select and context menu

I have understood.

 

But, I don't want to use the context menu linked to ListView object. And I don't want to add the bottom menubar.

 

I want only a listview where the user can select multi items.

 

Next, from the UI - a button in a container ; or my global context menu (not linked to listview but to a main container) - I need to retreive the items selected

 

Nicolas

 

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: ListView - Multi select and context menu

I've updated the JIRA you created with a link to this thread and made it Public.

 

I`m pasting the link of the issue here also, so people can vote on it.

 

https://www.blackberry.com/jira/browse/BBTEN-144

 

 

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: ListView - Multi select and context menu

[ Edited ]

Beside of, I have still issues.

 

I have enabled multiselect (so for the moment, I have an empty bottom menu bar and a context menu => what I want to remove...)

But, in my ListItem Container :

 

    listItemComponents: [
        ListItemComponent {
            type: "header"
            Container {
                Label {
                    text: {
                        ListItemData
                    }
                }
            }
        },
        ListItemComponent {
            type: "item"
            Container {
                Label {
                    text: {
                        ListItemData.name
                    }
                }
            }
            ListItem.onSelectedChanged: {
                setHighlight (ListItem.selected);
            }
        }
    ]
  
    function itemType(data, indexPath) {
        if (indexPath.length == 1)
            return "header";
        else
            return "item";
    }

I don't use the StandardListItem  ; and my "onSelectedChanged" slot is called when I select an other item ; so I can't select several items Smiley Sad

 

onSelected slot should call only when I select and unselect an item.

onActived slot should call when I pick an item.

 

So, if I click on item 1, then item2 ; I should have :

- onActive (item1, true)

- onSelect (item1, true)

- onActive (item1, false)
- onActive (item2, true)

- onSelect (item2, true)

 

To get onSelect(item1, false), I have to click again on the item1.

 

 

In fact, the ListView should work as in your AirSDK Smiley Happy

 

 

Nicolas

 

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: ListView - Multi select and context menu

At last, if you use a StackListLayout and you enable multi select mode, the context menu overwrite a part of list.

 

If you use a GridListLayout with small column and you enable multi select mode, the context menu overwrite a part of grid list ; and so can hide a column... So I think that you have to allow to developer to choose between overwrite a part of list or auto-resize the list.

 

Thanks

 

Nicolas

 

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: ListView - Multi select and context menu

Hi nicklas,

 

thanks a lot for your clarification and the details that you've added. I added a comment into the JIRA issue to refer this thread for further details.

 

I'm adding the JIRA here again, so people can vote on it. https://www.blackberry.com/jira/browse/BBTEN-144

 

Cheers,

 

Alex

Developer
Posts: 140
Registered: ‎07-24-2012
My Device: Blackberry Z10 LE, Q10 And PlayBook
My Carrier: Vodafone

Re: ListView - Multi select and context menu

very helpfull..

 

how to add the conttent of each item label that is Names in the list One by one into the text box or string

Hit Like if you find my post Use Full Thank You...