Interface IGrid
- All Superinterfaces:
IAnyGroup<IGrid>,IComponent<IGrid>,IComposite<IGrid,,IMeshComposite> IHtmlBasedComponent<IGrid>,IMeshElement<IGrid>,IXulElement<IGrid>
Grid component
Support @Action
| Name | Action Type |
|---|---|
| onPageSize | ActionData: PageSizeData
Notifies the paging size has been changed when the autopaging ( iGrid.withAutopaging(boolean)) is enabled and a user changed
the size of the content. |
Support Molds
| Name | Snapshot |
|---|---|
"default" |
![]() |
"paging" |
![]() |
Support Application Library Properties
-
To turn on the auto-sort facility to sort the model for this component, you have to specify
withAutosort(Autosort)toIGrid.Autosort.ENABLEorIGrid.Autosort.IGNORE_CHANGE.Or configure it from zk.xml by setting library properties. For example,
<library-property/> <name>org.zkoss.zul.grid.autoSort</name/> <value>true</value/> </library-property/>
- Author:
- katherine
- See Also:
-
Grid
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSpecifies whether to sort the model when the following cases: WithListModelcase andIColumn.withSortDirection(String)is set.IColumn.withSortDirection(String)is called. Model receivesListDataEventandIColumn.withSortDirection(String)is set. If you want to ignore sorting when receiving ListDataEvent, you can specify the value asIGrid.Autosort.IGNORE_CHANGE.static classBuilds instances of typeIGrid.static classBuilds an updater of typeIGridforUiAgent.smartUpdate(Locator, SmartUpdater).Nested classes/interfaces inherited from interface org.zkoss.stateless.sul.IMeshElement
IMeshElement.PagingPosition -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StringReturns whether to sort all items when model or sort direction be changed.Returns the auxhead child.Returns the columns.Returns the message to display when there are no itemsgetFoot()Returns the foot.Returns the frozen child.default StringReturns the inner width of this component.default StringReturns the style class for the odd rows.Returns the responsive policy set on this component, ornullif unset.Returns the responsive columns token string set on this component, used by"stacking"mode, ornullif unset.getRows()Returns the rows.default intReturns the visible rows.default StringReturns the client widget class.static IGridReturns the instance with the givenIRowBasechildren.static IGridReturns the instance with the givenIRowBasechildren.static IGridReturns the instance with the givenIColumncolumn children.static IGridReturns the instance with the givenIColumncolumn children.static IGridReturns the instance with the givenIColumnschild.static IGridReturns the instance with the givenIFootchild.static IGridReturns the instance with the givenIFooterfooter children.static IGridReturns the instance with the givenIFooterfooter children.static IGridReturns the instance with the given id.default IGridwithAllComponents(Iterable<? extends IMeshComposite> elements) Copy the current immutable object with elements that replace the content ofchildren.withAutosort(String autosort) Returns a copy ofthisimmutable component with the specifiedautosort.default IGridwithAutosort(IGrid.Autosort autosort) Returns a copy ofthisimmutable component with the specifiedautosort.withAuxhead(Iterable<? extends IAuxhead> auxhead) Returns a copy ofthisimmutable component with the specifiedauxhead.default IGridwithAuxhead(IAuxhead... auxhead) Returns a copy ofthisimmutable component with the specifiedauxhead.withColumns(IColumns columns) Returns a copy ofthisimmutable component with the specifiedcolumns.withEmptyMessage(String emptyMessage) Returns a copy ofthisimmutable component with the specifiedemptyMessage.Returns a copy ofthisimmutable component with the specifiedfoot.withFrozen(IFrozen frozen) Returns a copy ofthisimmutable component with the specifiedfrozen.withInnerWidth(String innerWidth) Returns a copy ofthisimmutable component with the specifiedinnerWidth.withOddRowSclass(String oddRowSclass) Returns a copy ofthisimmutable component with the specifiedoddRowSclass.withResponsive(String responsive) Returns a copy ofthisimmutable component with the specifiedresponsive.withResponsiveColumns(String responsiveColumns) Returns a copy ofthisimmutable component with the specifiedresponsiveColumns.Returns a copy ofthisimmutable component with the specifiedrows.withVisibleRows(int visibleRows) Returns a copy ofthisimmutable component with the specifiedvisibleRows.Methods 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.IMeshElement
getPagingChild, getPagingPosition, getSpan, isAutopaging, isNativeScrollbar, isSizedByContent, withAutopaging, withNativeScrollbar, withPagingChild, withPagingPosition, withPagingPosition, withSizedByContent, withSpan, withSpanMethods 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. -
PAGING
Constant for"paging"mold attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.grid.Grid"- Specified by:
getWidgetClassin interfaceIComponent<IGrid>
-
getRows
Returns the rows. -
withRows
Returns a copy ofthisimmutable component with the specifiedrows.Sets the rows as a child to this component
- Parameters:
rows- The rows child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getColumns
Returns the columns.Default:
null -
withColumns
Returns a copy ofthisimmutable component with the specifiedcolumns.Sets the columns as a child to this component
- Parameters:
columns- The columns child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getFoot
Returns the foot.Default:
null -
withFoot
Returns a copy ofthisimmutable component with the specifiedfoot.Sets the foot as a child to this component
- Parameters:
foot- The foot child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getFrozen
Returns the frozen child.Default:
null. -
withFrozen
Returns a copy ofthisimmutable component with the specifiedfrozen.Sets the frozen as a child to this component
- Parameters:
frozen- The foot child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getEmptyMessage
Returns the message to display when there are no items -
withEmptyMessage
Returns a copy ofthisimmutable component with the specifiedemptyMessage.Sets the message to display when there are no items
- Parameters:
emptyMessage- The message to display when there are no itemsDefault:
null.- Returns:
- A modified copy of the
thisobject
-
getVisibleRows
default int getVisibleRows()Returns the visible rows. Zero means no limitation.Default:
0. -
withVisibleRows
Returns a copy ofthisimmutable component with the specifiedvisibleRows.Sets the visible rows. Zero means no limitation.
- Parameters:
visibleRows- The visible rows. Zero means no limitation.Default:
0.- Returns:
- A modified copy of the
thisobject
-
getInnerWidth
Returns the inner width of this component. The inner width is the width of the inner table.Default: "100%"
-
withInnerWidth
Returns a copy ofthisimmutable component with the specifiedinnerWidth.Sets the inner width of this component. The inner width is the width of the inner table. By default, it is 100%. That is, it is the same as the width of this component. However, it is changed when the user is sizing the column's width.
Application developers rarely call this method, unless they want to preserve the widths of sizable columns changed by the user. To preserve the widths, the developer have to store the widths of all columns and the inner width (
getInnerWidth()), and then restore them when re-creating this component.- Parameters:
innerWidth- The inner width of this component.Default:
"100%".- Returns:
- A modified copy of the
thisobject
-
getAutosort
Returns whether to sort all items when model or sort direction be changed.Default:
false, if the"org.zkoss.zul.grid.autoSort"library property is not set in zk.xml.Note: it's meaningless if
ListModelis not set. -
withAutosort
Returns a copy ofthisimmutable component with the specifiedautosort.Sets to enable the auto-sort facility to sort the model for this component. Meaningless if
ListModelis not set.- Parameters:
autosort- The allowed values arenull,"false","true", and"ignore.change".Default:
null.- Returns:
- A modified copy of the
thisobject
-
withAutosort
Returns a copy ofthisimmutable component with the specifiedautosort.Sets to enable the auto-sort facility to sort the model for this component. Meaningless if
ListModelis not set.- Parameters:
autosort- The allowed values arenull,"false","true", and"ignore.change".Default:
null.- Returns:
- A modified copy of the
thisobject
-
getOddRowSclass
Returns the style class for the odd rows.Default:
IHtmlBasedComponent.getZclass()-odd. -
withOddRowSclass
Returns a copy ofthisimmutable component with the specifiedoddRowSclass.Sets the style class for the odd rows. If the style class doesn't exist, the striping effect disappears. You can provide different effects by providing the proper style classes.
- Parameters:
oddRowSclass- The style class for the odd rows.Default:
IHtmlBasedComponent.getZclass()-odd .- Returns:
- A modified copy of the
thisobject
-
getResponsive
Returns the responsive policy set on this component, ornullif unset.Like
Grid.getResponsive()this is the raw value; the zk.xml fallback is resolved bygetEffectiveResponsive()at render time.Default:
null.- Since:
- 11.0.0
-
withResponsive
Returns a copy ofthisimmutable component with the specifiedresponsive.Sets the responsive policy.
"stacking"turns the rows into vertical key-value blocks when the container width falls below the breakpoint;"none"disables it, overriding the library property. The stacking behavior itself is drawn by ZK PE (zkmax).Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IGrid.Updaterships the raw attribute while the initial render shipsgetEffectiveResponsive(). Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
responsive- one of"stacking","none", ornull(unset).Default:
null.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifresponsiveis neither"stacking","none", nornull.- Since:
- 11.0.0
-
getResponsiveColumns
Returns the responsive columns token string set on this component, used by"stacking"mode, ornullif unset.Like
Grid.getResponsiveColumns()this is the raw value; the zk.xml fallback is resolved bygetEffectiveResponsiveColumns()at render time. Unset means the client applies its own default cascade"sm-1 md-none".Default:
null.- Since:
- 11.0.0
-
withResponsiveColumns
Returns a copy ofthisimmutable component with the specifiedresponsiveColumns.Sets the responsive columns token string for
"stacking"mode. Breakpoint tokens separated by whitespace, where each token is<breakpoint>-<value>with breakpoint in {sm, md, lg, xl} and value either a positive integer (cards per row) ornone(switch back to table mode at and above this breakpoint).The string is stored verbatim — parsing, cascade resolution, and matching against the current container width happen on the client side. Invalid tokens are silently dropped by the client cascade resolver.
Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —IGrid.Updaterships the raw attribute while the initial render shipsgetEffectiveResponsiveColumns(). Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
responsiveColumns- The responsive columns token string, e.g."sm-1 md-2 lg-none".Default:
null.- Returns:
- A modified copy of the
thisobject - Since:
- 11.0.0
-
getAuxhead
Returns the auxhead child. -
withAuxhead
Returns a copy ofthisimmutable component with the specifiedauxhead.Sets the list of auxhead as children to this component
- Parameters:
auxhead- The auxhead children.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withAuxhead
Returns a copy ofthisimmutable component with the specifiedauxhead.Sets the auxhead as a child to this component
- Parameters:
auxhead- The auxhead child.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withAllComponents
Description copied from interface:ICompositeCopy the current immutable object with elements that replace the content ofchildren. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Specified by:
withAllComponentsin interfaceIComposite<IGrid,IMeshComposite> - Parameters:
elements- An iterable of children elements to set- Returns:
- A modified copy of
thisobject
-
of
Returns the instance with the givenIRowBasechildren.- Parameters:
children- The children ofIRowBase
-
of
Returns the instance with the givenIRowBasechildren.- Parameters:
children- The children ofIRowBase
-
ofColumns
Returns the instance with the givenIColumnschild.- Parameters:
columns- TheIColumnschild
-
ofColumns
Returns the instance with the givenIColumncolumn children.a shortcut of
IChildable.withChildren(java.lang.Iterable<? extends I>)- Parameters:
children- TheIColumnchildren
-
ofColumns
Returns the instance with the givenIColumncolumn children.a shortcut of
IChildable.withChildren(java.lang.Iterable<? extends I>)- Parameters:
children- TheIColumnchildren
-
ofFoot
Returns the instance with the givenIFootchild.- Parameters:
foot- TheIFootchild
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-

