selectedItems and listbox with multiple models

asked 2012-04-13 07:20:47 +0800

M4tt gravatar image M4tt
39 5

updated 2012-04-13 07:21:56 +0800

To make a long story short, I created an demo on zkfiddle (link below)

It's a multi select listbox with two data models.
The show button will show you how many items that are selected.
By checking or unchecking the checkbox , the listbox will switch between two different data models.

1. run the sample
2. select item4
3. click show , see 1 item are selected.
4. check the checkbox, it will switch to another model.
5. select any item you want
6. clcik show, see how many items are selected.

My question is how i can clear all the itmes in the selectedItems set when the data model is changed.
The items in two data models are just mixed into one selectedItems set.

Thank you.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-04-13 09:38:41 +0800

dennis gravatar image dennis
3669 1 6

public void setChecked(Boolean checked){
   this.checked = checked;
   if(selectedEntities!=null) selectedEntities.clear();

link publish delete flag offensive edit

answered 2012-04-16 02:37:58 +0800

M4tt gravatar image M4tt
39 5

oh..... Thank you.

link publish delete flag offensive edit
Your reply
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: 2012-04-13 07:20:47 +0800

Seen: 229 times

Last updated: Apr 16 '12

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