Way to get current unselected item of a multi select listbox

asked 2019-12-04 11:32:32 +0800

GaneshRocky gravatar image GaneshRocky
3 1

I have a listbox grid implemented with multiple=true and set all rows selected by default.

The requirement is to get the row/listitem unselected by end user. The selectedItems is giving list of selected items, but is there is a straight way to get the item currently unselected?

<listbox sclass="listbox" span="true" model="@load(vm.myModel)" multiple="true" checkmark="true" selectedItems="@bind(vm.selectedItemList)" onSelect="@command('itemSelected')" selectedItem="@bind(vm.currentSelectedItem)">

selecteItem is returning the first item in the list. itemSelected action too is giving only those items selected.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-12-05 13:22:23 +0800

hawk gravatar image hawk
2480 1 5
http://hawkphoenix.blogsp... ZK Team

Listbox.getSelection() returns you a Set. You can put your original complete data model in a Set, too. Then, find the difference of these 2 sets, you get the unselected data set.

The simplest way is:


For other ways, you can refer to https://stackoverflow.com/questions/18644579/getting-the-difference-between-two-sets

link publish delete flag offensive edit

answered 2019-12-07 10:14:36 +0800

GaneshRocky gravatar image GaneshRocky
3 1

Thanks for your quick reply @hawk. I thought there might be an existing feature to get the unselected items something like selectedItem. Now I have used removeAll and the problem is resolved.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2019-12-04 11:32:32 +0800

Seen: 12 times

Last updated: Dec 07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More