Custom Cells
Last updated
Last updated
Adds custom renderers to the DataEditor
. Each renderer provides its own drawing functionality and editor. See Implementing Custom Cells for more information.
The drawCell
property enables custom rendering of cells in the Grid. This function is called for each cell during the rendering process and is provided with a comprehensive set of parameters. These parameters include the drawing context (ctx
), cell data (cell
), theming details (theme
), the cell's rectangle (rect
), column and row indices (col
, row
), hover state information (hoverAmount
, hoverX
, hoverY
), a highlight flag (highlighted
), and an image loader (imageLoader
).
Additionally, drawCell
provides a drawContent
method, which, when called, immediately draws the default content of the cell onto the canvas. This design offers flexibility in how you render each cell. For instance, you can first draw a custom background, then call drawContent
to render the cell's standard contents, and finally add an overlay or additional embellishments. This approach allows for layered rendering, where you can seamlessly integrate custom graphics or styles with the grid's inherent rendering logic.
drawHeader
may be specified to override the rendering of a header. The grid will call this for every header it needs to render. Header rendering is not as well optimized because they do not redraw as often, but very heavy drawing methods can negatively impact horizontal scrolling performance.