fix: Date Column editing issue.

docs: add some examples.
This commit is contained in:
2024-02-05 09:52:26 +08:00
parent 12680cc662
commit 8a9ba4d4fb
7 changed files with 78 additions and 11 deletions

View File

@ -210,6 +210,8 @@ let r = lang;
* @property {(@deprecated)} [bgFilter] - **已过时**<br/>_根据返回值设置单元格背景色_
* @property {object} [events] - 给单元格元素附加事件(事件函数上下文为数据行对象)
* @property {Function} events.{event} - 事件回调函数
* @property {Function} events.{event}.{this} - 上下文为行数据对象
* @property {Function} events.{event}.e - 事件参数
* @property {(object | GridItemObjectCallback)} [attrs] - 根据返回值设置单元格元素的附加属性,允许直接设置对象也支持调用如下函数返回对象
* @property {GridColumnDefinition} attrs.{this} - 上下文为列定义对象
* @property {GridItem} attrs.item - 行数据对象
@ -244,12 +246,33 @@ let r = lang;
* {
* key: 'name',
* // type: Grid.ColumnTypes.Common,
* caption: 'Name'
* caption: 'Name',
* captionStyle: {
* 'font-style': 'italic'
* },
* width: 150,
* allowFilter: true
* },
* {
* key: 'birthday',
* type: Grid.ColumnTypes.Date,
* caption: 'Birthday',
* width: 120,
* dateMin: '1900-01-01',
* dateMax: '2025-01-01',
* dateValueFormatter: toDateValue
* },
* {
* key: 'age',
* type: Grid.ColumnTypes.Input,
* caption: 'Age'
* caption: 'Age',
* enabled: false,
* align: 'right',
* filter: item => {
* const ms = new Date() - new Date(item.birthday);
* const age = Math.floor(ms / 1000 / 60 / 60 / 24 / 365);
* return String(age);
* }
* },
* {
* key: 'sex',
@ -267,14 +290,31 @@ let r = lang;
* caption: 'Active'
* },
* {
* key: 'birthday',
* type: Grid.ColumnTypes.Date,
* caption: 'Birthday'
* },
* {
* key: 'remove',
* type: Grid.ColumnTypes.Icon,
* text: 'times'
* text: 'times',
* resizable: false,
* sortable: false,
* orderable: false,
* tooltip: 'Remove',
* events: {
* onclick: () => {
* showConfirm('Remove', 'Are you sure you want to remove this person?', [
* {
* key: 'yes',
* text: 'Yes',
* trigger: () => {
* console.log('yes');
* return true;
* }
* },
* {
* key: 'no',
* text: 'No'
* }
* ], 'question')
* }
* }
* }
* ]
*/