fix: Date Column editing issue.
docs: add some examples.
This commit is contained in:
@ -131,6 +131,10 @@ export class GridColumn {
|
||||
* @virtual
|
||||
*/
|
||||
|
||||
/**
|
||||
* 复写 [toString]{@linkcode String#toString} 方法
|
||||
* @private
|
||||
*/
|
||||
static toString() { return '[object Column]' }
|
||||
}
|
||||
|
||||
@ -417,6 +421,8 @@ export class GridIconColumn extends GridColumn {
|
||||
}
|
||||
|
||||
export class GridDateColumn extends GridColumn {
|
||||
static get editing() { return true };
|
||||
|
||||
static createEdit(trigger, col, _container, vals) {
|
||||
let enabled = col.enabled;
|
||||
if (typeof enabled === 'string') {
|
||||
@ -428,7 +434,15 @@ export class GridDateColumn extends GridColumn {
|
||||
return super.create();
|
||||
}
|
||||
const date = createDateInput(col.dateMin, col.dateMax);
|
||||
// date.addEventListener('change', trigger);
|
||||
date.addEventListener('change', () => {
|
||||
if (vals.__editing == null) {
|
||||
vals.__editing = {
|
||||
[col.key]: true
|
||||
}
|
||||
} else {
|
||||
vals.__editing[col.key] = true;
|
||||
}
|
||||
});
|
||||
date.addEventListener('blur', trigger);
|
||||
return date;
|
||||
}
|
||||
|
Reference in New Issue
Block a user