-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Wondering if there is an almost out of the box component offering a combobox with checkbox to select multiple values, and which would display selected value in a label separated by comma ?
I'm using MVC
Bandbox with an inner listbox is a good candidate, but I would want the input part to not allow the user to type anything and instead display there the selected value. While opening the bandbox when the user click on it.
Would that be possible ?
In case it helps someone else, went with a readonly bandbox containing a listbox to do what I wanted.
On the zul side :
<bandbox id="myBandBox" width="135px" readonly="true">
<bandpopup>
<listbox id="myListBox" width="135px" height="60px" multiple="true"
checkmark="true" />
</bandpopup>
</bandbox>
On the controler (MVC) side :
Retrieve the zul components
@Wire
private Bandbox myBandBox;
@Wire
private Listbox myListBox;
During initialization : 1 - add an event listener to open the bandbox even in readonly mode
myBandBox.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event arg0) throws Exception {
myBandBox.setOpen(true);
}
});
2 - fill the listbox with its listItems
3 - Add an event listener when checking the listITem
changeStatusListbox.addEventListener(Events.ON_SELECT, new EventListener<SelectEvent<Listitem, String>>() {
@Override
public void onEvent(SelectEvent<Listitem, String> event) throws Exception {
// Generates the label you want to display
StringBuilder labelToDisplaySB = new StringBuilde();
// Business logic checking that if all is selected, you will only display "ALL" else you will display the listItem labels separated with a comma or whatever ...
// Then set it as Value for the bandbox
statusBandBox.setValue(labelToDisplaySB.toString());
statusBandBox.setTooltiptext(statusBandBox.getValue());
}
});
maybe a chosenbox could help.
<style>
i.readOnly > input {
display: none;
}
</style>
<chosenbox sclass="readOnly">
Greetz chill.
Asked: 2016-12-20 16:40:35 +0800
Seen: 63 times
Last updated: Dec 21 '16
Equivalent to global command on MVC ?
How to capture onScroll Event of Combobox
combobox does not scroll autocompleted text into view
I want to take different value from label(value) and pass to @bind object
Combobox sometimes clears the selected item
zk combobox filtering option is not working inside listbox .
Zk create custom event for COmbo box?
Fetching Key-Value pair for ComboBox using SimpleListModel
How to set selected combobox when using setModel
ComboBox autocomplete does not work with onOk event [closed]