Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需要提供筛选api #591

Open
Rio-shuai opened this issue Sep 5, 2024 · 10 comments
Open

需要提供筛选api #591

Rio-shuai opened this issue Sep 5, 2024 · 10 comments

Comments

@Rio-shuai
Copy link

1.表格自带的筛选工具UI太丑了,需要自己实现筛选功能。但是没有提供外部调用的筛选API。

2.即使使用applyOp(ops)方法 也无法隐藏对应的行。通过鼠标右键隐藏行时明明也是这个ops,却无法直接调用applyOp,无法理解。
例如:
ops = [{
"op":"add",
"value":{
rowhidden:{1:0},
}
path:["config"],
id:1
}]

3.文档中op的描述太少了,无法让开发人员根据op自己实现对表格的操作,起码把表格自带操作的op都描述出来。

@Rio-shuai
Copy link
Author

  1. The filtering tool UI of the form is too ugly, so you need to implement the filtering function by yourself. However, no filtering API for external calls is provided.

  2. The corresponding row cannot be hidden even using the applyOp(ops) method. Hide the line through the right mouse button is obviously this ops, but can not directly call applyOp, can not understand.
    For example:
    ops = [{
    "op":"add",
    "value":{
    rowhidden:{1:0},
    }
    path:["config"],
    id:1
    }]

  3. The description of the op in the document is too little to allow the developer to implement the operation of the table according to the op itself, at least the op of the table's own operation is described.

@sanchit3008
Copy link
Collaborator

  1. do you have any specific suggestions for it to not look "ugly"?
  2. yes, this is currently not possible
  3. i agree that the documentation is limited, but sadly i dont have the access to update it either and havent been able to reach out to the owners of the repo for a few months now

@Rio-shuai
Copy link
Author

多谢回复
Thanks for your reply

  1. 最简单的办法就是支持筛选弹窗自定义,但是这样就需要组件提供筛选的API,这样就回到问题2了。
    The simplest solution is to support filtering pop-ups, but this requires the component to provide filtering apis.
  2. 如果实在没办法在原来的文档上迭代,我觉得可以在一个新的地方写上文档。这样起码如果有开发需要 总会找到。
    If there is no way to iterate over the original document, I think I can write the document in a new place. That way, at least if there's a development need, you'll always find it.

@sanchit3008
Copy link
Collaborator

sanchit3008 commented Sep 11, 2024

perhaps i am misunderstanding this a bit. can you give an example of what youd want for this api, or perhaps some other product which has this so i can refer to it.

@Rio-shuai
Copy link
Author

Rio-shuai commented Sep 12, 2024

设计一个针对列过滤表格的API。
已下只是我个人理解,不确定是否可以实现。

作用:针对表格某一列中数据筛选,最后显示符合预期的结果。大概思路是 隐藏不符合规则的行。

filterSheetForColumn(sheetId,column,(cellData)=>{})

参数说明
sheetId 表格id或者name
column 可以选择需要筛选的列
(cellData)=>{} 筛选的方法,cellData表格单元格数据,返回 ture或false

使用:过滤出第一列和第二列中单元格值为 '123' 的数据。
this.tableRef.current?.filterSheetForColumn('table1',['1','2'],(cellData)=>{
return cellData.v === '123';
})

或者更简单的直接提供一个隐藏某些行的API。
hideSheetForRow(sheetId,rows);
或者
setHideRowsConfig(sheetId,rows);

English translation
Design an API to filter tables for columns.
The following is just my personal understanding, not sure if it can be achieved.

Function: Filter the data in a column of the table, and finally display the expected result. The idea is to hide rows that do not conform to the rule.

filterSheetForColumn(sheetId,column,(cellData)=>{})

Parameter description
sheetId Table id or name
column You can select the columns to filter
(cellData)=>{} Filter method, cellData is cell data, method returns true or false

Use: Filter out data with cell value '123' in the first and second columns.
this.tableRef.current?.filterSheetForColumn('table1',['1','2'],(cellData)=>{
return cellData.v === '123';
})

Or, more simply, simply provide an API that hides certain lines.
hideSheetForRow(sheetId,rows);
perhaps
setHideRowsConfig(sheetId,rows);

@sanchit3008
Copy link
Collaborator

thanks for the detailed reply, so this boils down to an api for hiding rows programmatically.

something like setHiddenRows sounds good, and as you mentioned this will take sheetId and the rows to be hidden. i am looking into this request.

@sanchit3008
Copy link
Collaborator

im a bit confused, can we close this too or is this 2 separate issues mixed into 1

@Rio-shuai
Copy link
Author

Rio-shuai commented Sep 24, 2024

我感觉是两个问题
一个问题是希望增加一个API
另一个问题是使用 updateSheet 方法修改表格的一些 config 后表格没有刷新,需要手动调用 forceUpdate去刷新
只是恰巧在实现筛选功能过程中发现了这两个问题

I think it's two problems

One problem is the desire to add an API

Another problem is that the table does not refresh after modifying some config of the table using the updateSheet method, so you need to manually call forceUpdate to refresh it

It's a coincidence that I found these two problems while implementing the table filtering feature

@Rio-shuai
Copy link
Author

我看到了你对另一个问题的回复,非常感谢,你的效率非常高

I saw your reply on the other question, thank you very much, you are very efficient

@sanchit3008
Copy link
Collaborator

understood. if there is some other option in the config for which you need an api we can plan it out like the one for hiding rows/cols so that the sheet gets refreshed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants