Many types of DataCellRenderer objects are used to draw the individual data cells which should be drawn again during the grid rendering time. This renderer object can be specified through Column Properties or the dynamic styles or cell styles which will be covered in other examples. In other words, even if the cells contained in the same column, they can be displayed in different ways according to the cell value or the row state. DataCellRenderer uses GridStyles properties specified in the column and the properties of renderer itself to draw the data cells.
In this example, we will learn how to set or change some renderers in the column for the first time.
If do not specify the renderer in the column separately, TextCellRenderer will be used by default. Most cell renderers, including TextCellRenderer, use background and color to draw the cell background and text.
In addition, if set showTooltip of the renderer as true, it will display the cell value with a tooltip when the mouse is located over the corresponding cell.
In the grid above, "Unit" column has been specified through ShapeCellRenderer. And, the shape has been set as "triangle" through shapeName and the shape color has been set through shapeColor. The display location of the shape can be specified through iconLocation (shapeLocation from v1.2.5).
Please refer to ShapeCellRenderer topic for more details.
"Unit Price" and "Quantity" columns use BarCellRenderer. You can use minimum and maximum properties of the renderer to specify the range of the value, and use origin to specify the direction of the bar.
Please refer to BarCellRenderer topic for more details.