Date
Double-click a date to open the calendar editor and choose another day.
The date column type adds a calendar editor through the revogrid-column-date package, based on duetds-date-picker.
Use it for date strings or date values that should be edited with a date picker instead of plain text input.
You can pass duetds-date-picker properties through the column definition:
js
const columns = [
{
prop: 'birthdate',
columnType: 'date',
direction: 'left',
required: 'true',
valueAsDate: 'true',
},
]Installation
npm
npm i @revolist/revogrid-column-datepnpm
pnpm add @revolist/revogrid-column-dateyarn
yarn add @revolist/revogrid-column-datebun
bun add @revolist/revogrid-column-dateBasic usage
- Import the date column type.
- Register it in
columnTypes. - Set
columnType: 'date'on date columns. - Pass picker options on the column when needed.
js
// do import
import Plugin from '@revolist/revogrid-column-date'
const columns = [{ prop: 'birthdate', columnType: 'date' }]
const rows = [{ birthdate: '2020-08-24' }, { birthdate: '2022-08-24' }]
// register column type
const columnTypes = { date: new Plugin() }
// apply data to grid per your framework approach
<revo-grid source={rows} columns={columns} columnTypes={columnTypes} />Keep the date value format consistent across the column. If your application stores dates in a different shape than the editor displays, normalize the value before assigning source or handle conversion in your save workflow.