Skip to content

[Bug] 处理 Row Frozen 的时候没有考虑到数据为空数组的情况 #3766

@BubbleLeaf

Description

@BubbleLeaf

Version

1.17.7

Link to Minimal Reproduction

https://visactor.io/vtable/demo/table-type/list-table

Steps to Reproduce

打开上面官方的列子,将下面的代码拷贝到代码区域,1s之后将在console中出现错误信息

let tableInstance;
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json')
  .then(res => res.json())
  .then(data => {
    const columns = [
      {
        field: 'Order ID',
        title: 'Order ID',
        width: 'auto'
      },
      {
        field: 'Customer ID',
        title: 'Customer ID',
        width: 'auto'
      },
      {
        field: 'Product Name',
        title: 'Product Name',
        width: 'auto'
      },
      {
        field: 'Category',
        title: 'Category',
        width: 'auto'
      },
      {
        field: 'Sub-Category',
        title: 'Sub-Category',
        width: 'auto'
      },
      {
        field: 'Region',
        title: 'Region',
        width: 'auto'
      },
      {
        field: 'City',
        title: 'City',
        width: 'auto'
      },
      {
        field: 'Order Date',
        title: 'Order Date',
        width: 'auto'
      },
      {
        field: 'Quantity',
        title: 'Quantity',
        width: 'auto'
      },
      {
        field: 'Sales',
        title: 'Sales',
        width: 'auto'
      },
      {
        field: 'Profit',
        title: 'Profit',
        width: 'auto'
      }
    ];

    const option = {
      frozenColCount:2, 
      rightFrozenColCount:1,
      frozenRowCount:1, 
      bottomFrozenRowCount:1,
      records: [],
      columns,
      widthMode: 'standard'
    };
    tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option);
    window['tableInstance'] = tableInstance;
    setTimeout(()=>{
      const cols=tableInstance.columns
      cols[1].hide=true
      tableInstance.updateColumns(cols)
    },1000)
  });

Current Behavior

目前就是报错,导致表格崩溃

Expected Behavior

解决错误就行

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions