Handsontable 重复表

Posted

技术标签:

【中文标题】Handsontable 重复表【英文标题】:Handsontable duplicate tables 【发布时间】:2019-05-25 15:41:52 【问题描述】:

两个问题: 1. 使用@handsontable/angular时不断收到重复表。如果我创建两个表,那么这些词就不再重叠了。 2. 如果我使用colHeadersrowHeaders,则无法选择任何单元格。

不完全确定发生了什么。我怀疑它与引导程序冲突?

顶部图像显示标题的重叠。第二张图片是我添加另一个hot-table

一张桌子:

  <hot-table class="hot inline-block vert-top" 
    [data]="data" [colHeaders]="colHeaders" [rowHeaders]="rowHeaders"
    [tableClassName]="['table', 'table-hover', 'table-striped']"
    >
    </hot-table>

两个表:

  <hot-table></hot-table>

  <hot-table class="hot inline-block vert-top" 
    [data]="data" [colHeaders]="colHeaders" [rowHeaders]="rowHeaders"
    [tableClassName]="['table', 'table-hover', 'table-striped']"
    >
    </hot-table>

组件.ts

  ngOnInit() 
    let headers = [];
    this.rowHeaders = ['Revenue', 'Gross Profit', 'SGA', 'Total Operating Expense']
    this.selection = Object.keys(this.income);

    for (var j=0;j< this.rowHeaders.length;j++)
      const temp = [];
      for (var i = 0; i < this.income['Year'].length; i++) 
        let head = this.income['Year'][i] + this.income['Type'][i] + this.income['Qtr'][i] 
        if (headers.indexOf(head) < 0 )
           headers.push(head);
        
        temp.push(this.income[this.rowHeaders[j]][i])
      
      this.data.push( temp )
    
    this.colHeaders = headers;
  

也试过这个: duplicate headers when using Handsontable

我尝试冻结标题。结果一样。

【问题讨论】:

【参考方案1】:

handsontable 样式表不应该从应用的全局样式表中导入,而是从angular.json 配置文件中导入

只需在node_modules/../handsontable 配置中添加node_modules/../handsontable 中的路径。

【讨论】:

以上是关于Handsontable 重复表的主要内容,如果未能解决你的问题,请参考以下文章

在 Asp.Net 中的 Handsontable ,重复表

在 rhandsontable 中禁用列编辑?

使用 Handsontable 时出现重复的标题

无论如何用 Handsontable 过滤行?

Handsontable 保存公式值

“module/index.d.ts”和“@types/module/index.d.ts”之间的打字稿冲突