Package org.zkoss.stateless.sul

## Interface IGrid

- All Superinterfaces:
    `IAnyGroup<IGrid>`, `IComponent<IGrid>`, `IComposite<IGrid,​IMeshComposite>`, `IHtmlBasedComponent<IGrid>`, `IMeshElement<IGrid>`, `IXulElement<IGrid>`

      public interface IGrid
      extends IMeshElement<IGrid>, IComposite<IGrid,​IMeshComposite>, IAnyGroup<IGrid>

  Immutable `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)` to `IGrid.Autosort.ENABLE` or `IGrid.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/>

  Note: with zk.xml setting, it will affect to all tree components.
  Author:
    katherine
  See Also:
    `Grid`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `IGrid.Autosort` | Specifies whether to sort the model when the following cases: With `ListModel` case and `IColumn.withSortDirection(String)` is set. `IColumn.withSortDirection(String)` is called. Model receives `ListDataEvent` and `IColumn.withSortDirection(String)` is set. If you want to ignore sorting when receiving ListDataEvent, you can specify the value as `IGrid.Autosort.IGNORE_CHANGE`.
    `static class` | `IGrid.Builder` | Builds instances of type `IGrid`.
    `static class` | `IGrid.Updater` | Builds an updater of type `IGrid` for `UiAgent.smartUpdate(Locator, SmartUpdater)`.

    - ### Nested classes/interfaces inherited from interface org.zkoss.stateless.sul.IMeshElement

      `IMeshElement.PagingPosition`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static IGrid` | `DEFAULT` | Constant for default attributes of this immutable component.
    `static IGrid` | `PAGING` | Constant for `"paging"` mold attributes of this immutable component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default java.lang.String` | `getAutosort()` | Returns whether to sort all items when model or sort direction be changed.
    `default java.util.List<IAuxhead>` | `getAuxhead()` | Returns the auxhead child.
    `IColumns` | `getColumns()` | Returns the columns.
    `java.lang.String` | `getEmptyMessage()` | Returns the message to display when there are no items
    `IFoot` | `getFoot()` | Returns the foot.
    `IFrozen` | `getFrozen()` | Returns the frozen child.
    `default java.lang.String` | `getInnerWidth()` | Returns the inner width of this component.
    `default java.lang.String` | `getOddRowSclass()` | Returns the style class for the odd rows.
    `IRows` | `getRows()` | Returns the rows.
    `default int` | `getVisibleRows()` | Returns the visible rows.
    `default java.lang.String` | `getWidgetClass()` | Returns the client widget class.
    `static IGrid` | `of​(java.lang.Iterable<? extends IRowBase> children)` | Returns the instance with the given `IRowBase` children.
    `static IGrid` | `of​(IRowBase... children)` | Returns the instance with the given `IRowBase` children.
    `static IGrid` | `ofColumns​(java.lang.Iterable<? extends IColumn<IAnyGroup>> children)` | Returns the instance with the given `IColumn` column children.
    `static IGrid` | `ofColumns​(IColumn<IAnyGroup>... children)` | Returns the instance with the given `IColumn` column children.
    `static IGrid` | `ofColumns​(IColumns columns)` | Returns the instance with the given `IColumns` child.
    `static IGrid` | `ofFoot​(IFoot foot)` | Returns the instance with the given `IFoot` child.
    `static IGrid` | `ofFooters​(java.lang.Iterable<? extends IFooter<IAnyGroup>> children)` | Returns the instance with the given `IFooter` footer children.
    `static IGrid` | `ofFooters​(IFooter<IAnyGroup>... children)` | Returns the instance with the given `IFooter` footer children.
    `static IGrid` | `ofId​(java.lang.String id)` | Returns the instance with the given id.
    `default IGrid` | `withAllComponents​(java.lang.Iterable<? extends IMeshComposite> elements)` | Copy the current immutable object with elements that replace the content of `children`.
    `IGrid` | `withAutosort​(java.lang.String autosort)` | Returns a copy of `this` immutable component with the specified `autosort`.
    `default IGrid` | `withAutosort​(IGrid.Autosort autosort)` | Returns a copy of `this` immutable component with the specified `autosort`.
    `IGrid` | `withAuxhead​(java.lang.Iterable<? extends IAuxhead> auxhead)` | Returns a copy of `this` immutable component with the specified `auxhead`.
    `default IGrid` | `withAuxhead​(IAuxhead... auxhead)` | Returns a copy of `this` immutable component with the specified `auxhead`.
    `IGrid` | `withColumns​(IColumns columns)` | Returns a copy of `this` immutable component with the specified `columns`.
    `IGrid` | `withEmptyMessage​(java.lang.String emptyMessage)` | Returns a copy of `this` immutable component with the specified `emptyMessage`.
    `IGrid` | `withFoot​(IFoot foot)` | Returns a copy of `this` immutable component with the specified `foot`.
    `IGrid` | `withFrozen​(IFrozen frozen)` | Returns a copy of `this` immutable component with the specified `frozen`.
    `IGrid` | `withInnerWidth​(java.lang.String innerWidth)` | Returns a copy of `this` immutable component with the specified `innerWidth`.
    `IGrid` | `withOddRowSclass​(java.lang.String oddRowSclass)` | Returns a copy of `this` immutable component with the specified `oddRowSclass`.
    `IGrid` | `withRows​(IRows rows)` | Returns a copy of `this` immutable component with the specified `rows`.
    `IGrid` | `withVisibleRows​(int visibleRows)` | Returns a copy of `this` immutable component with the specified `visibleRows`.

    - ### 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, withWidgetOverrides`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent

      `getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IMeshElement

      `getPagingChild, getPagingPosition, getSpan, isAutopaging, isNativeScrollbar, isSizedByContent, withAutopaging, withNativeScrollbar, withPagingChild, withPagingPosition, withPagingPosition, withSizedByContent, withSpan, withSpan`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IXulElement

      `getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip`

- - ### Field Detail

    - #### DEFAULT

          static final IGrid DEFAULT

      Constant for default attributes of this immutable component.

    - #### PAGING

          static final IGrid PAGING

      Constant for `"paging"` mold attributes of this immutable component.

  - ### Method Detail

    - #### getWidgetClass

          default java.lang.String getWidgetClass()

      Returns the client widget class.

      Default: `"zul.grid.Grid"`

      Specified by:
        `getWidgetClass` in interface `IComponent<IGrid>`

    - #### getRows

          @Nullable
          IRows getRows()

      Returns the rows.

    - #### withRows

          IGrid withRows​(@Nullable
                         IRows rows)

      Returns a copy of `this` immutable component with the specified `rows`.

      Sets the rows as a child to this component

      Parameters:
        `rows` - The rows child.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getColumns

          @Nullable
          IColumns getColumns()

      Returns the columns.

      Default: `null`

    - #### withColumns

          IGrid withColumns​(@Nullable
                            IColumns columns)

      Returns a copy of `this` immutable component with the specified `columns`.

      Sets the columns as a child to this component

      Parameters:
        `columns` - The columns child.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getFoot

          @Nullable
          IFoot getFoot()

      Returns the foot.

      Default: `null`

    - #### withFoot

          IGrid withFoot​(@Nullable
                         IFoot foot)

      Returns a copy of `this` immutable component with the specified `foot`.

      Sets the foot as a child to this component

      Parameters:
        `foot` - The foot child.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getFrozen

          @Nullable
          IFrozen getFrozen()

      Returns the frozen child.

      Default: `null`.

    - #### withFrozen

          IGrid withFrozen​(@Nullable
                           IFrozen frozen)

      Returns a copy of `this` immutable component with the specified `frozen`.

      Sets the frozen as a child to this component

      Parameters:
        `frozen` - The foot child.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getEmptyMessage

          @Nullable
          java.lang.String getEmptyMessage()

      Returns the message to display when there are no items

    - #### withEmptyMessage

          IGrid withEmptyMessage​(@Nullable
                                 java.lang.String emptyMessage)

      Returns a copy of `this` immutable component with the specified `emptyMessage`.

      Sets the message to display when there are no items

      Parameters:
        `emptyMessage` - The message to display when there are no items

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getVisibleRows

          default int getVisibleRows()

      Returns the visible rows. Zero means no limitation.

      Default: `0`.

    - #### withVisibleRows

          IGrid withVisibleRows​(int visibleRows)

      Returns a copy of `this` immutable component with the specified `visibleRows`.

      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 `this` object

    - #### getInnerWidth

          default java.lang.String getInnerWidth()

      Returns the inner width of this component. The inner width is the width of the inner table.

      Default: "100%"

    - #### withInnerWidth

          IGrid withInnerWidth​(java.lang.String innerWidth)

      Returns a copy of `this` immutable component with the specified `innerWidth`.

      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 `this` object

    - #### getAutosort

          @Nullable
          default java.lang.String 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 `ListModel` is not set.

    - #### withAutosort

          IGrid withAutosort​(@Nullable
                             java.lang.String autosort)

      Returns a copy of `this` immutable component with the specified `autosort`.

      Sets to enable the auto-sort facility to sort the model for this component. Meaningless if `ListModel` is not set.

      Parameters:
        `autosort` - The allowed values are `null`, `"false"`, `"true"`, and `"ignore.change"`.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### withAutosort

          default IGrid withAutosort​(@Nullable
                                     IGrid.Autosort autosort)

      Returns a copy of `this` immutable component with the specified `autosort`.

      Sets to enable the auto-sort facility to sort the model for this component. Meaningless if `ListModel` is not set.

      Parameters:
        `autosort` - The allowed values are `null`, `"false"`, `"true"`, and `"ignore.change"`.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getOddRowSclass

          default java.lang.String getOddRowSclass()

      Returns the style class for the odd rows.

      Default: `IHtmlBasedComponent.getZclass()`-odd.

    - #### withOddRowSclass

          IGrid withOddRowSclass​(java.lang.String oddRowSclass)

      Returns a copy of `this` immutable component with the specified `oddRowSclass`.

      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 `this` object

    - #### getAuxhead

          default java.util.List<IAuxhead> getAuxhead()

      Returns the auxhead child.

    - #### withAuxhead

          IGrid withAuxhead​(java.lang.Iterable<? extends IAuxhead> auxhead)

      Returns a copy of `this` immutable component with the specified `auxhead`.

      Sets the list of auxhead as children to this component

      Parameters:
        `auxhead` - The auxhead children.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### withAuxhead

          default IGrid withAuxhead​(IAuxhead... auxhead)

      Returns a copy of `this` immutable component with the specified `auxhead`.

      Sets the auxhead as a child to this component

      Parameters:
        `auxhead` - The auxhead child.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### withAllComponents

          default IGrid withAllComponents​(java.lang.Iterable<? extends IMeshComposite> elements)

      Description copied from interface: `IComposite`
      Copy the current immutable object with elements that replace the content of `children`. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
      Specified by:
        `withAllComponents` in interface `IComposite<IGrid,​IMeshComposite>`
      Parameters:
        `elements` - An iterable of children elements to set
      Returns:
        A modified copy of `this` object

    - #### of

          static IGrid of​(java.lang.Iterable<? extends IRowBase> children)

      Returns the instance with the given `IRowBase` children.
      Parameters:
        `children` - The children of `IRowBase`

    - #### of

          static IGrid of​(IRowBase... children)

      Returns the instance with the given `IRowBase` children.
      Parameters:
        `children` - The children of `IRowBase`

    - #### ofColumns

          static IGrid ofColumns​(IColumns columns)

      Returns the instance with the given `IColumns` child.
      Parameters:
        `columns` - The `IColumns` child

    - #### ofColumns

          static IGrid ofColumns​(java.lang.Iterable<? extends IColumn<IAnyGroup>> children)

      Returns the instance with the given `IColumn` column children.

      a shortcut of `IChildable.withChildren(java.lang.Iterable<? extends I>)`

      Parameters:
        `children` - The `IColumn` children

    - #### ofColumns

          static IGrid ofColumns​(IColumn<IAnyGroup>... children)

      Returns the instance with the given `IColumn` column children.

      a shortcut of `IChildable.withChildren(java.lang.Iterable<? extends I>)`

      Parameters:
        `children` - The `IColumn` children

    - #### ofFoot

          static IGrid ofFoot​(IFoot foot)

      Returns the instance with the given `IFoot` child.
      Parameters:
        `foot` - The `IFoot` child

    - #### ofFooters

          static IGrid ofFooters​(java.lang.Iterable<? extends IFooter<IAnyGroup>> children)

      Returns the instance with the given `IFooter` footer children.

      a shortcut of `IChildable.withChildren(java.lang.Iterable<? extends I>)`

      Parameters:
        `children` - The `IFooter` children

    - #### ofFooters

          static IGrid ofFooters​(IFooter<IAnyGroup>... children)

      Returns the instance with the given `IFooter` footer children.

      a shortcut of `IChildable.withChildren(java.lang.Iterable<? extends I>)`

      Parameters:
        `children` - The `IFooter` children

    - #### ofId

          static IGrid ofId​(java.lang.String id)

      Returns the instance with the given id.
      Parameters:
        `id` - The id to identify this component