From Documentation

Jump to: navigation, search





Contents

Cascader

  • Available for ZK:
  • http://www.zkoss.org/product/zkhttp://www.zkoss.org/whyzk/zkeeVersion ee.png
[ since 9.0.0 ]

Employment/Purpose

A Cascader is a dropdown list in a tree structure and supports TreeModel.

Example

Cascader-example.png

    <zscript><![CDATA[
        DefaultTreeModel tm = new DefaultTreeModel(new DefaultTreeNode("ROOT",
        Arrays.asList(new DefaultTreeNode[]{
                new DefaultTreeNode("David", Arrays.asList(new TreeNode[]{new DefaultTreeNode("David-1"),
                                 new DefaultTreeNode("David-2")})),
                new DefaultTreeNode("Thomas",new ArrayList()),
                new DefaultTreeNode("Steven",new ArrayList())})));
    ]]></zscript>
    <cascader width="300px" model="${tm}" />

Users can select in layers, and the selected items are converted into text. (Default: joining by slashes, i.g. "A/B/C")

Properties

Disabled

Sets whether it is disabled. A disabled component can't interact with users.

ItemConverter

The converter generates the label text shown in the cascader. By implementing your own Converter, you can generate the label that represents the selected item. The default implementation is joining all the toString() result of items by slashes.

ItemRenderer

See also: ZK_Developer's_Reference/MVC/View/Renderer/Cascader_Renderer

The item renderer is used to render each item.

The easiest way is to use the default implementation and use <template name="model">. Or, by implementing your own ItemRenderer, you can generate the HTML fragment yourself for the data model.

Model

The tree model associated with this cascader.

Open

Drops down or closes the list of items.

Placeholder

When the selected item is empty, the placeholder text would be displayed. (Default: empty)

SelectedItem

Represents the selected item, or null if no item is selected.

Items are selected only if the leaf item is selected. For example, in an A - B - C structure, selected item remains null until the leaf node C is selected.

Supported Events

Name
Event Type
onAfterRender
Event: Event

Notifies one that the model's data has been rendered.

onSelect
Event: SelectEvent

Represents an event caused by user's the selection changed at the client.

onOpen
Event: OpenEvent

Represents an event that indicates an open state that is changed at the client.

Supported Children

* None

Use Cases

Version Description Example Location
     

Version History

Last Update : 2019/11/19


Version Date Content
9.0.0 November, 2019 ZK-4392: Provide a cascader component




Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.