DateColumn
A column that displays a date in the specified format. By default L format is used, which
contains the following info: full year, 2-digit month, and 2-digit day. Depending on the browser locale,
the formatted date might look different. Intl.DateTimeFormat API
is used to format the date. Here is an example of possible outputs depending on the browser locale:
// These options represent `L` format
const options = { year : 'numeric', month : '2-digit', day : '2-digit' };
new Intl.DateTimeFormat('en-US', options).format(new Date(2021, 6, 1)); // "07/01/2021"
new Intl.DateTimeFormat('ru-RU', options).format(new Date(2021, 6, 1)); // "01.07.2021"
// Formatting using Bryntum API
LocaleManager.applyLocale('En');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "07/01/2021"
LocaleManager.applyLocale('Ru');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "01.07.2021"
To learn more about available formats check out DateHelper docs.
The field this column reads data from should be a type of date.
Default editor is a DateField.
new Grid({
columns : [
{ type: 'date', text: 'Start date', format: 'YYYY-MM-DD', field: 'start' }
]
});
//<code-header>
fiddle.title = 'Date column';
//</code-header>
// grid with DateColumn
const grid = new Grid({
appendTo : targetElement,
// makes grid as high as it needs to be to fit rows
autoHeight : true,
data : DataGenerator.generateData(5),
columns : [
{ field : 'name', text : 'Name', flex : 1 },
{ type : 'date', field : 'start', text : 'DateColumn', format : 'YYYY-MM-DD', flex : 1 }
]
});Configs
84
Configs
84Common
The name of the data model date field to read data from.
Date format to convert a given date object into a string to display. By default L format is used, which
contains the following info: full year, 2-digit month, and 2-digit day. Depending on the browser locale,
the formatted date might look different. Intl.DateTimeFormat API
is used to format the date. Here is an example of possible outputs depending on the browser locale:
// These options represent `L` format
const options = { year : 'numeric', month : '2-digit', day : '2-digit' };
new Intl.DateTimeFormat('en-US', options).format(new Date(2021, 6, 1)); // "07/01/2021"
new Intl.DateTimeFormat('ru-RU', options).format(new Date(2021, 6, 1)); // "01.07.2021"
// Formatting using Bryntum API
LocaleManager.applyLocale('En');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "07/01/2021"
LocaleManager.applyLocale('Ru');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "01.07.2021"
To learn more about available formats check out DateHelper docs.
Note, the field this column reads data from should be a type of date.
Time increment duration value to apply when clicking the left / right trigger icons. See
step for more information
Set to null to hide the step triggers.
Other
Max value for the cell editor
Min value for the cell editor
Rendering
Renderer function, used to style the date displayed in the cell. Can also affect other aspects of the cell, such as styling.
new Grid({
columns : [
{ type : 'date', text : 'Date of birth', field : 'dob' },
]
});
You can modify the row element too from inside a renderer to add custom CSS classes:
new Grid({
columns : [
{
type : 'date',
text : 'Date of birth',
field : 'dob',
renderer : ({ record, row }) => {
// Add special CSS class to new rows that have not yet been saved
row.cls.newRow = record.isPhantom;
return record.dob;
}
]
});
| Parameter | Type | Description |
|---|---|---|
renderData | Object | Object containing renderer parameters |
renderData.cellElement | HTMLElement | Cell element, for adding CSS classes, styling etc. Can be |
renderData.value | Date | null | undefined | The Date value to be displayed in the cell |
renderData.record | Model | Record for the row |
renderData.column | Column | This column |
renderData.grid | Grid | This grid |
renderData.row | Row | Row object. Can be null in case of export. Use the row's API to manipulate CSS class names. |
renderData.size | Object | Set |
renderData.size.height | Number | Set this to request a certain row height |
renderData.size.configuredHeight | Number | Row height that will be used if none is requested |
renderData.isExport | Boolean |
|
renderData.isMeasuring | Boolean | True if the column is being measured for a |
Integration
Interaction
Menu
Misc
Properties
154
Properties
154Common
The name of the data model date field to read data from.
Date format to convert a given date object into a string to display. By default L format is used, which
contains the following info: full year, 2-digit month, and 2-digit day. Depending on the browser locale,
the formatted date might look different. Intl.DateTimeFormat API
is used to format the date. Here is an example of possible outputs depending on the browser locale:
// These options represent `L` format
const options = { year : 'numeric', month : '2-digit', day : '2-digit' };
new Intl.DateTimeFormat('en-US', options).format(new Date(2021, 6, 1)); // "07/01/2021"
new Intl.DateTimeFormat('ru-RU', options).format(new Date(2021, 6, 1)); // "01.07.2021"
// Formatting using Bryntum API
LocaleManager.applyLocale('En');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "07/01/2021"
LocaleManager.applyLocale('Ru');
DateHelper.format(new Date(2021, 6, 1), 'L'); // "01.07.2021"
To learn more about available formats check out DateHelper docs.
Note, the field this column reads data from should be a type of date.
Time increment duration value to apply when clicking the left / right trigger icons. See
step for more information
Set to null to hide the step triggers.
Class hierarchy
Other
Max value for the cell editor
Min value for the cell editor
Rendering
Renderer function, used to style the date displayed in the cell. Can also affect other aspects of the cell, such as styling.
new Grid({
columns : [
{ type : 'date', text : 'Date of birth', field : 'dob' },
]
});
You can modify the row element too from inside a renderer to add custom CSS classes:
new Grid({
columns : [
{
type : 'date',
text : 'Date of birth',
field : 'dob',
renderer : ({ record, row }) => {
// Add special CSS class to new rows that have not yet been saved
row.cls.newRow = record.isPhantom;
return record.dob;
}
]
});
| Parameter | Type | Description |
|---|---|---|
renderData | Object | Object containing renderer parameters |
renderData.cellElement | HTMLElement | Cell element, for adding CSS classes, styling etc. Can be |
renderData.value | Date | null | undefined | The Date value to be displayed in the cell |
renderData.record | Model | Record for the row |
renderData.column | Column | This column |
renderData.grid | Grid | This grid |
renderData.row | Row | Row object. Can be null in case of export. Use the row's API to manipulate CSS class names. |
renderData.size | Object | Set |
renderData.size.height | Number | Set this to request a certain row height |
renderData.size.configuredHeight | Number | Row height that will be used if none is requested |
renderData.isExport | Boolean |
|
renderData.isMeasuring | Boolean | True if the column is being measured for a |