is the union type of all rows in the DataTable or DataTableCore.
is the type of row that the the current object is designed for.
is the type of name and of ColName in the this passed to some functions
is the type of the cellProps property.
OptionalcellContains props to apply to each cell in this column (except to the standard header cell), or a function to get a set of props that depends on the current row.
OptionalRenderThis component is used to render a data cell. Usually it should be left undefined
so that the DefaultDataTableCell component will be used. If you just want to add
attributes to the <td> element, you can set cellProps instead.
If you provide this prop, you are responsible for rendering the outer <td> element,
and for using other relevant attributes of the column and the cell to produce output,
such as:
cellProps and colSpan in your output, if applicableprops.value) into the outputisTreeCol may be true, e.g. by calling
props.renderTreeIndent?.() and including its output at the left edge of the cell.OptionalgetThis function allows you to cause this column to span multiple columns sometimes.
If this function returns a value greater than one, the default row rendering code
will skip rendering the spanned columns after this column (e.g. if it returns 3,
the row renderer skips rendering two columns afterward) and the default cell
renderer will set the colSpan prop on the td. If this function returns a value
less than one, it's treated the same as one.
OptionalgetProvide this to customize the way that the value of this column is obtained
from a row. If this is not provided, node.item[this.name.toString()] is used. The
value obtained from this function is passed to the renderer via TableCellProps.
The return type should be ReactNode if you don't provide renderCell or RenderCell,
and string|number|boolean if you don't provide sorting properties such as
getSortableValue or compare.
If the table has a getRowConfig prop, it is called before getValue, both to
determine what value of item will be passed to getValue, and also which getValue
function will be called, in case you provide different getValue functions for
different row types.
As a case study, let's consider Date. Here are the main ways you might handle
rendering and sorting for them:
Date to a string in getValue, then provide a separate
getSortableValue function that just returns the Date so that the column can be
sorted correctly. In this case, you don't need to provide renderCell.Date from getValue, then check in renderCell whether props.value
is actually a Date and, if so, format it as a string or JSX there.getValue function at all, only a renderCell. In this case,
name must refer to the property that contains the Date, and renderCell must
convert the Date to a string or JSX.OptionalrenderThis function is called to render a column value to a ReactNode, not including the
outer <td> element. If not provided, defaultRenderCell is used.
You must provide renderCell or RenderCell if the cell's value (determined by name
or getValue) is not always a ReactNode (string, number, boolean or JSX).
You can think of rendering customizations as a three-level hierarchy:
getValue prop: in charge of selecting low-level cell content, such as a
string, number, boolean or <span>. DefaultDataTableRow calls this function
and stores the result in TableCellProps.value.renderCell prop: in charge of selecting the "main" cell content, such as a
<div> element to control padding.RenderCell prop: the top level, in charge of rendering the entire cell
including <td> and the tree indent (if any).In the simplest cases (e.g. string or boolean columns) you may not need to
customize any of these, and in simple cases you only need to provide getValue.
On the other end of the scale, you can provide RenderCell for maximum control.
It is recommended that each level use the output of the previous level, i.e.
RenderCell should get the "main" cell content by calling the function
column.renderCell ?? defaultRenderCell, while renderCell should include
props.value in its output.
*
Settings for rendering cells in a specific column, either for a specific type of row (if this object is in the map returned by the table's
getRowConfigprop), or for all rows. This type is a subset ofDataTableColumn. The most important properties aregetValueandrenderCell.