AfGrid
AfGrid wraps the MUI DataGridPro to bind it to an Appframe data object.
The following binding is done:
Bind the currently loaded data in the
rowspropertyPersist user changes to the layout in Indexed DB. Like the DevEx XtraGrid grid, the layout can be reset by changing the
layoutVersionpropEnables editing rows if the data object is editable
Adds an
Addbutton to the toolbar if inserting new rows is allowedBinds filtering and sorting to the data object. Sort binding can be disabled with the
disableServerSortingproperty, since some functionality in the MUI grid does not work with server side sorting (e.g. grouping)Enables paging on the grid if the data object is dynamic loading, and binds the page size to the
maxRecordsparameterCan optionally bind the current index of the data object to the grid selection by setting the
bindIndexproperty totrue
Three properties must always be set on the grid:
id- A name of the grid used to persist the grid layout in Indexed DBdataObject- The data object to bind the grid tocolumns- Column definitions for the grid
Notes on keyboard navigation
The grid should only be a single tab stop on the page. If you use custom cell rendering to render a component that is focusable, it is important to use the tabIndex value of the GridCellParams to make sure the component is only focusable when the cell is focused.
let columns: AfGridColumn[] = [
{
field: "ProjectID",
editable: false,
headerName: "ID",
renderCell: (params: GridCellParams<any, any, any>) => (
<Link to={`/${params.row.ProjectID}/`} tabIndex={params.tabIndex}>
{params.value}
</Link>
),
},
];Usage
For more information on how to use the grid, see the MUI documentation.
Last updated
Was this helpful?