Column

A single column in a Columns element. Each child of the Column element is placed in each successive cell of the grid. The column with the most child elements determines the number of rows in each column. The use of column is mainly to define attributes for each cell in the grid.

<window title="Grid Demo" border="normal" width="360px">
    <zscript>    
    class Comp implements Comparator {    
        private boolean _asc;        
        public Comp(boolean asc) {        
            _asc = asc;            
        }        
        public int compare(Object o1, Object o2) {        
            String s1 = o1.getChildren().get(0).getValue(),            
                s2 = o2.getChildren().get(0).getValue();                
            int v = s1.compareTo(s2);            
            return _asc ? v: -v;            
        }        
    }    
    Comp asc = new Comp(true), dsc = new Comp(false);    
    </zscript>    
    <grid>    
        <columns sizable="true">        
            <column label="Type" sortAscending="&#36;{asc}" sortDescending="&#36;{dsc}"/>            
            <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>    
</window>

Class Name

org.zkoss.zul.Column

Supported Child Components

*ALL

Supported Events

Name

Event Type

onClick

org.zkoss.zk.ui.event.MouseEvent

Description: Denotes user has clicked the component.

onRightClick

org.zkoss.zk.ui.event.MouseEvent

Description: Denotes user has right-clicked the component.

onDoubleClick

org.zkoss.zk.ui.event.MouseEvent

Description: Denotes user has double-clicked the component.

Properties

Property

Description

Data Type

Default Value

sortAscending

Sets the ascending sorter, or null for no sorter for the ascending order.

java.util.Comparator

<null>

sortDescending

Sets the descending sorter, or null for no sorter for the descending order.

java.util.Comparator

<null>

sortDirection

Sets the sort direction.

Value: ascending|descending|natural

java.lang.String

natural

Methods

Name

Description

Return Data Type

getGrid()

Returns the grid that contains this column.

org.zkoss.zul.Grid

getOuterAttrs()

java.lang.String

getSclass()

Returns the style class.

java.lang.String

onSort()

It invokes sort(boolean) to sort list items and maintain getSortDirection().

void

setParent(org.zkoss.zk.ui.Component parent)

void

setSortAscending(java.lang.String)

Sets the ascending sorter with the class name, or null for no sorter for the ascending order.

void

setSortDescending(java.lang.String)

Sets the descending sorter with the class name, or null for no sorter for the descending order.

void

sort(boolean)

Sorts the rows (Row) based on getSortAscending() and getSortDescending(), if getSortDirection() doesn't matches the ascending argument.

boo lean

sort(boolean, boolean)

Sorts the rows (Row) based on getSortAscending() and getSortDescending().

boo lean

Inherited From