Columns
A column is a plain dictionary. prop is required and selects the value from each source row.
columns = [
{
"prop": "id",
"name": "ID",
"readonly": True,
"pin": "colPinStart",
"size": 90,
},
{
"prop": "customer",
"name": "Customer",
"sortable": True,
"minSize": 140,
},
{
"prop": "amount",
"name": "Amount",
"sortable": True,
"filter": "number",
"order": "desc",
},
]Common JSON-safe column fields are:
| Field | Purpose |
|---|---|
prop | Row key used by the column |
name | Header label |
size, minSize, maxSize | Width constraints in pixels |
readonly | Disable editing for the column |
sortable, order | Enable sorting and set asc or desc order |
filter | Enable a string, number, or other built-in filter family |
pin | Use colPinStart or colPinEnd |
rowDrag | Add a row-drag handle |
columnType | Apply a preset from the grid-level columnTypes prop |
Function-valued column members are not supported in v1. This includes cellTemplate, columnTemplate, cellProperties, columnProperties, cellCompare, cellParser, constructor-based editor values, function-based readonly, and function-based rowDrag.
Use the Column Configuration guide, the complete ColumnRegular interface, and the ColumnGrouping interface to inspect the Core schema. When reading those pages, remember that Dash can use only primitive and plain-object members.
Column groups
Nested header groups are plain objects and therefore work across the Dash boundary:
columns = [
{
"name": "Customer",
"children": [
{"prop": "first_name", "name": "First name"},
{"prop": "last_name", "name": "Last name"},
],
},
{
"name": "Order",
"children": [
{"prop": "status", "name": "Status"},
{"prop": "amount", "name": "Amount", "filter": "number"},
],
},
]See Column Grouping.
Reusable column types
columnTypes can hold JSON-safe presets:
RevoGrid(
columnTypes={
"identifier": {"readonly": True, "size": 120},
"money": {"size": 140, "sortable": True, "filter": "number"},
},
columns=[
{"prop": "id", "name": "ID", "columnType": "identifier"},
{"prop": "amount", "name": "Amount", "columnType": "money"},
],
source=rows,
style={"height": 420},
)See Column Types and Formats and Advanced Configuration.
Common feature recipes
Editing, range selection, and clipboard
RevoGrid(
source=rows,
columns=columns,
readonly=False,
range=True,
useClipboard={"rangeFill": True},
applyOnClose=True,
style={"height": 420},
)readonly=Truemakes the complete grid read-only.- A column-level
readonly=Truelocks only that column. range=Trueenables multi-cell selection.useClipboard=Trueenables the built-in copy/paste behavior.rangeFillrequires range selection.
References: Editing, Clipboard, ClipboardConfig, and Selection API.
Filtering and sorting
Enable the filter plugin at grid level, then opt columns into a filter family:
RevoGrid(
filter={
"collection": {
"status": {"type": "eq", "value": "Open"},
}
},
sorting={
"columns": [
{"prop": "amount", "order": "desc"},
],
"additive": False,
},
columns=[
{"prop": "status", "name": "Status", "filter": "string"},
{
"prop": "amount",
"name": "Amount",
"filter": "number",
"sortable": True,
},
],
source=rows,
style={"height": 420},
)Custom filter functions and custom sorting comparators are JavaScript functions, so they are not supported through Python in v1.
References: Filtering, ColumnFilterConfig, Sorting, and SortingConfig.
Row grouping
RevoGrid(
grouping={
"props": ["region", "team"],
"expandedAll": True,
"preserveGroupingOnUpdate": True,
},
columns=columns,
source=rows,
style={"height": 420},
)groupLabelTemplate and getGroupValue are functions and cannot cross the Python boundary. The plain-object grouping options work.
References: Row Grouping and GroupingOptions.
Sizing, pinned rows, and column movement
RevoGrid(
colSize=120,
rowSize=34,
rowHeaders={"size": 56},
resize=True,
autoSizeColumn=True,
stretch="last",
canMoveColumns=True,
pinnedTopSource=[{"name": "Current selection"}],
pinnedBottomSource=[{"name": "Total"}],
columns=columns,
source=rows,
style={"height": 500},
)References: Grid Size, Column Resize, Column Autosize, Column Stretch, Column Ordering, Row Headers, and Pinned Rows.
Themes, RTL, accessibility, and virtualization
RevoGrid(
theme="compact",
rtl=False,
accessible=True,
frameSize=1,
disableVirtualX=False,
disableVirtualY=False,
columns=columns,
source=rows,
style={"height": 420},
)Virtual rendering is enabled by default. Leave it enabled for large sources. virtualX can restrict which column dimensions use X-axis virtualization; its values come from DimensionCols.
References: Themes, RTL, Accessibility, Performance and Virtualization, and Viewports.