Angular13 Handsontable 下拉菜单不工作
Angular13 Handsontable Dropdown Not Working
我的 componet.ts 中有一个 handsontable,当我尝试使用下拉列表并单击向下箭头时,它只是变成了一个文本编辑器。只是想知道如何让下拉菜单正常工作。
componet.ts
dateToday: number = Date.now();
private hotRegisterer = new HotTableRegisterer();
id = 'hotInstance';
hotSettings: Handsontable.GridSettings = {
maxRows: 22,
startRows: 2,
startCols: 2,
contextMenu : true,
height: 'auto',
width: 'auto',
minSpareRows: 1,
columns: [
{
type: 'dropdown',
source: ['sn', 'st']
},
{
editor: 'text'
},
{
type: 'date',
dateFormat: 'MM/DD/YYYY',
correctFormat: true,
defaultDate: this.dateToday+'',
}
],
colHeaders: ['Asset Type','Serial Number','Shipdate'],
rowHeaders: true,
colWidths: 300,
licenseKey: 'non-commercial-and-evaluation'
}
html
<div class="hot">
<hot-table [hotId]="id" [settings]="hotSettings"></hot-table>
</div>
这是 handsontable 的问题。 https://github.com/handsontable/handsontable/issues/9452
解决方法是添加
从'handsontable/helpers'导入{createEmptySpreadsheetData};
在下面
热设置:Handsontable.GridSettings = {}
添加
数据:createEmptySpreadsheetData(4, 4),
这必须是 4 或更大,否则下拉列表将不起作用。然后在 packages.json 下的 exports 你必须添加
"./helpers/data.d.ts": "./helpers/data.d.ts",
"./helpers": {
"要求": "./helpers/data.js",
"导入": "./helpers/data.mjs"
},
我的 componet.ts 中有一个 handsontable,当我尝试使用下拉列表并单击向下箭头时,它只是变成了一个文本编辑器。只是想知道如何让下拉菜单正常工作。
componet.ts
dateToday: number = Date.now();
private hotRegisterer = new HotTableRegisterer();
id = 'hotInstance';
hotSettings: Handsontable.GridSettings = {
maxRows: 22,
startRows: 2,
startCols: 2,
contextMenu : true,
height: 'auto',
width: 'auto',
minSpareRows: 1,
columns: [
{
type: 'dropdown',
source: ['sn', 'st']
},
{
editor: 'text'
},
{
type: 'date',
dateFormat: 'MM/DD/YYYY',
correctFormat: true,
defaultDate: this.dateToday+'',
}
],
colHeaders: ['Asset Type','Serial Number','Shipdate'],
rowHeaders: true,
colWidths: 300,
licenseKey: 'non-commercial-and-evaluation'
}
html
<div class="hot">
<hot-table [hotId]="id" [settings]="hotSettings"></hot-table>
</div>
这是 handsontable 的问题。 https://github.com/handsontable/handsontable/issues/9452
解决方法是添加
从'handsontable/helpers'导入{createEmptySpreadsheetData};
在下面
热设置:Handsontable.GridSettings = {}
添加
数据:createEmptySpreadsheetData(4, 4),
这必须是 4 或更大,否则下拉列表将不起作用。然后在 packages.json 下的 exports 你必须添加
"./helpers/data.d.ts": "./helpers/data.d.ts",
"./helpers": {
"要求": "./helpers/data.js",
"导入": "./helpers/data.mjs" },