0

Multiple selection in listbox with databinding

asked 2012-01-05 09:00:26 +0800

Neus gravatar image Neus
1415 14

Hi,
I have a listbox with attributes multiple="true" and checkmark="true".
When the listbox is created (with no items because items only appears when a button is clicked) the checkmark to select multiple items is displayed in the listheader.
But when I fill the listbox with data (binder.loadComponent(LBFicheros)) the checkbox disappears and a radiobutton is displayed in each row. I checked if the listbox for some reason changes to multiple="false" but is not so, listbox is still multiple.

Any idea why is this happening?

My listbox:

<listbox  id="LBFicheros" multiple="true" checkmark="true" width="100%" vflex="1" mold="paging" autopaging="true"  model="@{VentanaFicheros$composer.listaBeans}">
          <listhead sizable="true">
                    ...
          </listhead>
          <listitem id="fila" self="@{each=ServidorBean}" value="@{ServidorBean}">
                    <listcell label="@{ServidorBean.Tabla}" tooltiptext="@{ServidorBean.Tabla}" style="text-align:left;white-space:nowrap"/>
                     ....
         </listitem>
</listbox>

delete flag offensive retag edit

15 Replies

Sort by ยป oldest newest

answered 2012-02-21 08:35:04 +0800

Neus gravatar image Neus
1415 14

Yes I use ZK 6.
This is my getItems():

private Set <ServidorBean> selected;
public Set<ServidorBean> getSelected() {
	return selected;
}

link publish delete flag offensive edit

answered 2012-02-21 09:50:50 +0800

Matze2 gravatar image Matze2
773 7

This is the method for the binding

selectedItems="@bind(vm.selected)"

I wanted to know how you bind
model="@load(vm.items)"

link publish delete flag offensive edit

answered 2012-02-21 10:14:19 +0800

Neus gravatar image Neus
1415 14

Yes sorry.
Here the code:

private ListModelList<ServidorBean> _items = new ListModelList<ServidorBean>();
public List<ServidorBean> getItems () {
	return _items;
}

link publish delete flag offensive edit

answered 2012-02-21 10:21:11 +0800

Matze2 gravatar image Matze2
773 7

updated 2012-02-21 10:21:28 +0800

I haven't used ListModelList directly yet, I always pass an ordinary Java List (ArrayList).
I think you need to set multiple flag on that ListModelList before you provide it to the ZK binding.

link publish delete flag offensive edit

answered 2012-02-21 11:09:43 +0800

Neus gravatar image Neus
1415 14

Finally yes!It's because ListModelList. With Java List multiple is set automatically.
Thank you Matze

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

Follow

RSS

Stats

Asked: 2012-01-05 09:00:26 +0800

Seen: 1,397 times

Last updated: Feb 21 '12

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