Columns"

From Documentation
m (correct highlight (via JWB))
 
(6 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
[[Image:ZKComRef_Grid_Example.png‎]]  
 
[[Image:ZKComRef_Grid_Example.png‎]]  
  
<source lang="xml" >
+
<syntaxhighlight lang="xml" >
 
+
    <grid>
<window title="Grid Demo" border="normal" width="360px">
+
        <columns sizable="true">
<zscript> class Comp implements Comparator { private boolean _asc;
+
            <column label="Type" hflex="min"/>
public Comp(boolean asc) { _asc = asc; } public int compare(Object o1,
+
            <column label="Content"/>
Object o2) { String s1 = o1.getChildren().get(0).getValue(), s2 =
+
        </columns>
o2.getChildren().get(0).getValue(); int v = s1.compareTo(s2); return
+
        <rows>
_asc ? v: -v; } } Comp asc = new Comp(true), dsc = new Comp(false);
+
            <row>
</zscript>
+
                <label value="File:"/>
<grid>
+
                <textbox width="99%"/>
<columns sizable="true">
+
            </row>
<column label="Type" sortAscending="&#36;{asc}"
+
            <row>
sortDescending="&#36;{dsc}" width="50px"/>
+
                <label value="Type:"/>
<column label="Content" />
+
                <hbox>
</columns>
+
                    <listbox rows="1" mold="select">
<rows>
+
                        <listitem label="Java Files,(*.java)"/>
<row>
+
                        <listitem label="All Files,(*.*)"/>
<label value="File:" />
+
                    </listbox>
<textbox width="99%" />
+
                    <button label="Browse..."/>
</row>
+
                </hbox>
<row>
+
            </row>
<label value="Type:" />
+
            <row>
<hbox>
+
                <label value="Options:"/>
<listbox rows="1" mold="select">
+
                <textbox rows="3" width="99%"/>
<listitem label="Java Files,(*.java)" />
+
            </row>
<listitem label="All Files,(*.*)" />
+
        </rows>
</listbox>
+
    </grid>
<button label="Browse..." />
+
</syntaxhighlight>
</hbox>
 
</row>
 
<row>
 
<label value="Options:" />
 
<textbox rows="3" width="99%" />
 
</row>
 
</rows>
 
</grid>
 
</window>
 
</source>
 
  
 
=Properties=
 
=Properties=
 
==Menupopup==
 
==Menupopup==
By default, the ''none'' is assumed, you can specify the ''auto'' to appear a default menu for the columns. Or you can provide your own menupopup for the component.
+
By default, the <code>none</code> is assumed, you can specify the <code>auto</code> to show a default menu on each column. Or you can provide your own menupopup for each column.
 
===Auto===
 
===Auto===
 
[[Image:ZKComRef_Grid_Columns_Menu.png]]
 
[[Image:ZKComRef_Grid_Columns_Menu.png]]
Line 96: Line 86:
 
== Sizable ==
 
== Sizable ==
  
Specifies whether the user is allowed to size a column of a grid (by dragging the vertical bar between two adjacent columns).
+
Specifies whether a user is allowed to resize a column's width by dragging the vertical bar between two adjacent columns.
 +
 
 +
[[File:Sizable.png|center]]
  
Notice that, in additions to dragging, the end user could 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 functionality.
+
=== 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=
 
=Supported Events=

Latest revision as of 03:17, 21 February 2023

Columns

Employment/Purpose

Defines the columns of a grid.

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


Example

ZKComRef Grid Example.png

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

Properties

Menupopup

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.

Auto

ZKComRef Grid Columns Menu.png

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

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"/>
	</menupopup>
	<grid>
		<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"/>
		</columns>
	</grid>
</window>

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

Sizable

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

Sizable.png

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

Name
Event Type
None None

Supported Children

* Column

Use Cases

Grid

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.