-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
in ZK 6.0, how can i display a listbox, with checkmark=true, multiple=true and all value selected by default ?
I got that but it's not working
SimpleListModel<TypeEvent> slm = new SimpleListModel<TypeEvent>( TypeEventImpl.getInstance().getTypesEvent() ); //We load types slm.setMultiple(true); lstType.setCheckmark(true); lstType.setModel( slm ); lstType.setItemRenderer(ter); for(int i = 0 ; i < slm.getSize() ; i++){ lstType.getItemAtIndex(i).setSelected(true); }
Thanks
I am not an expert in Java only approaches, but I think you need to maintain your selection state in the model, not in the UI objects - in your case Listitem.
Hello
I find a way to do it
slm = new SimpleListModel<TypeEvent>( TypeEventImpl.getInstance().getTypesEvent() ); //We load types slm.setMultiple(true); for(int i = 0 ; i < slm.getSize() ; i++) slm.addToSelection( (TypeEvent)slm.getElementAt(i));
I'm not sure it's the best way, but it's working
Nico
Asked: 2012-05-02 00:44:22 +0800
Seen: 138 times
Last updated: May 03 '12