From Documentation
Revision as of 03:17, 21 February 2023 by Hawk (talk | contribs) (→‎Double-Click to Auto-Resize)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



Defines the columns of a grid.

Each child of a columns element should be a org.zkoss.zul.Column element.


ZKComRef Grid Example.png

        <columns sizable="true">
            <column label="Type" hflex="min"/>
            <column label="Content"/>
                <label value="File:"/>
                <textbox width="99%"/>
                <label value="Type:"/>
                    <listbox rows="1" mold="select">
                        <listitem label="Java Files,(*.java)"/>
                        <listitem label="All Files,(*.*)"/>
                    <button label="Browse..."/>
                <label value="Options:"/>
                <textbox rows="3" width="99%"/>



By default, the none is assumed, you can specify the auto to show a default menu on each column. Or you can provide your own menupopup for each column.


ZKComRef Grid Columns Menu.png

		<columns menupopup="auto">
			<column label="Author" sort="auto"/>
			<column label="Title" sort="auto"/>
			<column label="Publisher" sort="auto"/>
			<column label="Hardcover" sort="auto"/>

Customized Menupopup

ZKComRef Grid Columns Customized Menu.png

<window title="Column's Menu Demo" border="normal" width="500px">
	<menupopup id="editPopup">
        <menuitem label="Group" image="~./zul/img/grid/menu-group.png"/>
        <menuitem label="Sort Ascending" image="~./zul/img/grid/menu-arrowup.png"/>
        <menuitem label="Sort Descending" image="~./zul/img/grid/menu-arrowdown.png"/>
		<columns sizable="true" menupopup="editPopup">
			<column id="col" label="Type" sortAscending="&#36;{asc}" sortDescending="&#36;{dsc}"/>
			<column id="col1" label="Type1" sortAscending="&#36;{asc}" sortDescending="&#36;{dsc}"/>
			<column id="col2" label="Content"/>

As you can see, the example above specify a customized menupopup to the columns as its column menu.


Specifies whether a user is allowed to resize a column's width by dragging the vertical bar between two adjacent columns.


Double-Click to Auto-Fit

In additions to dragging, an end user can double-click on the vertical bar between two adjacent columns, such that the grid will automatically resize the column to fit its contents. In other words, all sizable column provides the auto-fitting feature.

Supported Events

Event Type
None None

Supported Children

* Column

Use Cases


Version History

Last Update : 2023/02/21

Version Date Content

Last Update : 2023/02/21

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