Grid Template

From Documentation

Similar to Listbox, you can define a customer rendering with a template for a grid:

<grid model="${books}">
		<column label="ISBN" sort="auto"/>
		<column label="Name" sort="auto"/>
		<column label="Description"/>
	<template name="model">
			<label value="${each.isbn}"/>
			<label value="${}"/>
			<label value="${each.description}"/>

where books is assumed as an instance of ListModel that contains a list of the Book instances while each Book instances has at least three getter methods: getIsbn, getName and getDescription.

Notice that the template named model must be associated with the grid, i.e., it must be a direct child element of the grid element as shown above. A common mistake is to put it under the rows element. Remember the template is a ZUML fragment telling the grid how to render a row, and the template itself is not a component.

Template for GroupsModel

When used with GroupsModel, grids will use the template called model:grouping for rendering the grouping object. If it is not defined, it will look for the template called model instead (i.e., the same template is used for rendering the grouping and non-grouping objects).

<grid mode="${fooGroupsModel}">
   <template name="model:group">
      <group open="${}">....</group>
   <template name="model">
   <template name="model:groupfoot">
  • Note the groupingInfo is used to get the information of the grouping data. Please refer to GroupingInfo

Version History

Version Date Content
6.0.0 July 2011 The template feature was introduced.
6.0.0 January 2012 The GroupingInfo statement was introduced.

Last Update : 2022/07/08

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