ruilisi/fortune-sheet

通过 updateSheet 修改表格配置实现隐藏行后表格未刷新,需要提供手动刷新表格的API。

Closed this issue · 4 comments

场景:需要隐藏表格的某些行。
代码:

const sheet = this.tableRef.current?.getAllSheets()[0];
const tableData = {
    ...sheet,
    config: {
        ...sheet.config,
        rowhidden: {
            1:0,
            2:0, 
        },
    },
};
this.tableRef.current?.updateSheet(tableData);
//运行后代码表格没有变化。

this.forceUpdate();
//强制刷新后隐藏了对应行

English
Scenario: Some rows of a table need to be hidden.
Code:

const sheet = this.tableRef.current? .getAllSheets()[0];
const tableData = {
    ... sheet,
    config: {
        ... sheet.config,
        rowhidden: {
            1:0,
            2:0,
        },
    },
};
this.tableRef.current? .updateSheet(tableData);
// The code table does not change after running.

this.forceUpdate();
// The corresponding row is hidden after a forced refresh

you are looking to hide some rows on component initialisation ?

是的 我想要在使用表格过程中 手动隐藏一些符合条件的行。
上面的代码是通过修改表格配置并且重新渲染可以实现。

Yes I want to manually hide some eligible rows while using the table.

The above code can be achieved by modifying the table configuration and re-rendering.

rephrasing this, we need a direct method for hideRow and hideColumn in the workbook ref. perfectly justified ask, let me see what i can do about this. thanks for submitting the request @Rio-shuai

i have implemented this, will try to release a new version by tonight with the other fixes i had merged last week.