Interface ICombobox
- All Superinterfaces:
IAnyGroup<ICombobox>,IChildable<ICombobox,,IComboitem> IChildrenOfInputgroup<ICombobox>,IComponent<ICombobox>,IHtmlBasedComponent<ICombobox>,IInputElement<ICombobox,,String> IReadonly<ICombobox>,ITextboxBase<ICombobox>,IXulElement<ICombobox>
Combobox component
A combobox is a special text box that embeds a drop-down list. With comboboxes, users are allowed to select from a drop-down list, in addition to entering the text manually.
Support @Action
| Name | Action Type |
|---|---|
| onSelect | ActionData: SelectData
Represents an action caused by user's the list selection is changed at the client. |
| onOpen | ActionData: OpenData
Denotes that the user has opened or closed a component. Note: unlike onClose, this action is only a notification.
The client sends this action after opening or closing the component.
It is useful to implement load-on-demand by listening to the onOpen action, and creating components when the first time
the component is opened.
|
Mouseless Entry
Alt+DOWNto pop up the list.Alt+UPorESCto close the list.UPandDOWNto change the selection of the items from the list.ENTERto confirm the change of selection.ESCto abort the change of selection. It is meaningful ifinstantSelectis false.
Autocomplete
By default, it will autocomplete your input with the first item in the list that has the same starting string in a case-insensitive way.
- Author:
- katherine
- See Also:
-
Combobox
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeICombobox.static classBuilds an updater of typeIComboboxforUiAgent.smartUpdate(Locator, SmartUpdater).Nested classes/interfaces inherited from interface org.zkoss.stateless.sul.ITextboxBase
ITextboxBase.Type -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns the empty search message if any.default StringReturns the iconSclass name of this Combobox.Returns the width of the popup of this componentdefault intReturns the index of the selected item, or -1 if not selected.default StringReturns the client widget class.default booleanReturns whether to automatically complete this text box by matching the nearest item (IComboitem.default booleanReturns whether to automatically drop the list if users is changing this text box.default booleanReturns whether the button (on the right of the timebox) is visible.default booleanReturns true if onSelect event is sent as soon as user selects using keyboard navigation.default booleanisOpen()Returns whether this combobox is open.static IComboboxof(Iterable<? extends IComboitem> children) Returns the instance with the givenIComboitemchildren.static IComboboxReturns the instance with the given value.static IComboboxof(IComboitem... children) Returns the instance with the givenIComboitemchildren.static IComboboxofConstraint(String constraint) Returns the instance with the given constraint.static IComboboxReturns the instance with the given id.withAutocomplete(boolean autocomplete) Returns a copy ofthisimmutable component with the specifiedautocomplete.withAutodrop(boolean autodrop) Returns a copy ofthisimmutable component with the specifiedautodrop.withButtonVisible(boolean buttonVisible) Returns a copy ofthisimmutable component with the specifiedbuttonVisible.withEmptySearchMessage(String emptySearchMessage) Returns a copy ofthisimmutable component with the specifiedemptySearchMessage.withIconSclass(String iconSclass) Returns a copy ofthisimmutable component with the specifiediconSclass.withInstantSelect(boolean instantSelect) Returns a copy ofthisimmutable component with the specifiedinstantSelect.withOpen(boolean open) Returns a copy ofthisimmutable component with the specifiedsclass.withPopupWidth(String popupWidth) Returns a copy ofthisimmutable component with the specifiedpopupWidth.withSelectedIndex(int selectedIndex) Returns a copy ofthisimmutable component with the specifiedselectedIndex.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IInputElement
getCols, getConstraint, getErrorboxIconSclass, getErrorboxSclass, getErrorMessage, getInputAttributes, getInstant, getMaxlength, getName, getPlaceholder, getValue, isDisabled, isInplace, withCols, withConstraint, withDisabled, withErrorboxIconSclass, withErrorboxSclass, withErrorMessage, withInplace, withInputAttributes, withInstant, withMaxlength, withName, withPlaceholderMethods inherited from interface org.zkoss.stateless.sul.IReadonly
isReadonly, withReadonlyMethods inherited from interface org.zkoss.stateless.sul.ITextboxBase
getRows, getType, isMultiline, isSubmitByEnter, isTabbable, withMultiline, withRows, withSubmitByEnter, withTabbable, withType, withType, withValueMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.inp.Combobox"- Specified by:
getWidgetClassin interfaceIComponent<ICombobox>
-
getPopupWidth
Returns the width of the popup of this componentDefault:
null -
withPopupWidth
Returns a copy ofthisimmutable component with the specifiedpopupWidth.Sets the width of the popup of this component. If the input is a percentage, the popup width will be calculated by multiplying the width of this component with the percentage. (e.g. if the input string is
130%, and the width of this component is300px, the popup width will be390px = 300px * 130%) Others will be set directly.- Parameters:
popupWidth- The width of the popup of this component.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getEmptySearchMessage
Returns the empty search message if any. Default:null -
withEmptySearchMessage
Returns a copy ofthisimmutable component with the specifiedemptySearchMessage.Sets empty search message. This message would be displayed, when no matching results was found. Note: it's meaningless if no model case.
- Parameters:
emptySearchMessage- The empty search message to display.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getSelectedIndex
default int getSelectedIndex()Returns the index of the selected item, or -1 if not selected. -
withSelectedIndex
Returns a copy ofthisimmutable component with the specifiedselectedIndex.Deselects the currently selected items and selects the item with the given index.
Note: if the label of
IComboitemhas the same more than one, the firstIComboitemwill be selected at client side, it is a limitation ofIComboboxand it is different fromIListbox.- Parameters:
selectedIndex- The selected index of the combobox.Default:
-1, meaning not selected.- Returns:
- A modified copy of the
thisobject
-
isAutodrop
default boolean isAutodrop()Returns whether to automatically drop the list if users is changing this text box.Default:
false. -
withAutodrop
Returns a copy ofthisimmutable component with the specifiedautodrop.Sets whether to automatically drop the list if users is changing this text box.
- Parameters:
autodrop-trueto enable the auto-drop facility.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isAutocomplete
default boolean isAutocomplete()Returns whether to automatically complete this text box by matching the nearest item (IComboitem. It is also known as auto-type-ahead.If true, the nearest item will be searched and the text box is updated automatically. If false, user has to click the item or use the DOWN or UP keys to select it back.
Don't confuse it with the auto-completion feature mentioned by other framework. Such kind of auto-completion is supported well by listening to the
onChangingaction.Default:
true -
withAutocomplete
Returns a copy ofthisimmutable component with the specifiedautocomplete.Sets whether to automatically complete this text box by matching the nearest item (
IComboitem.- Parameters:
autocomplete-falseto disable the auto-completion feature.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isButtonVisible
default boolean isButtonVisible()Returns whether the button (on the right of the timebox) is visible.Default:
true. -
withButtonVisible
Returns a copy ofthisimmutable component with the specifiedbuttonVisible.Sets whether the button (on the right of the combobox) is visible.
- Parameters:
buttonVisible-falseto disable the button visibility.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isInstantSelect
default boolean isInstantSelect()Returns true if onSelect event is sent as soon as user selects using keyboard navigation.Default:
true -
withInstantSelect
Returns a copy ofthisimmutable component with the specifiedinstantSelect.Sets the instantSelect attribute. When the attribute is true,
onSelectaction will be fired as soon as user selects using keyboard navigation. If the attribute is false, user needs to pressEnter keyto finish the selection using keyboard navigation.- Parameters:
instantSelect-falseto disable the button visibility.Default:
true.- Returns:
- A modified copy of the
thisobject
-
getIconSclass
Returns the iconSclass name of this Combobox.Default:
Combobox.ICON_SCLASS -
withIconSclass
Returns a copy ofthisimmutable component with the specifiediconSclass.Sets the iconSclass name of this Combobox.
- Parameters:
iconSclass- The iconSclass name of this Combobox.Default:
Combobox.ICON_SCLASS- Returns:
- A modified copy of the
thisobject
-
isOpen
default boolean isOpen()Returns whether this combobox is open.Default:
false. -
withOpen
Returns a copy ofthisimmutable component with the specifiedsclass.Sets whether this combobox is open or not.
- Parameters:
open-trueto open the dropdown.Default:
false- Returns:
- A modified copy of the
thisobject
-
of
Returns the instance with the given value.- Parameters:
value- The value of the component
-
of
Returns the instance with the givenIComboitemchildren.- Parameters:
children- The children ofIComboitem
-
of
Returns the instance with the givenIComboitemchildren.- Parameters:
children- The children ofIComboitem
-
ofConstraint
Returns the instance with the given constraint.- Parameters:
constraint- The combobox constraint
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-