VisActor / VisActor/VTable

表头checkbox的半选状态不对

Open
#4,505 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.7k
Forks
486
Avg merge
1d 19h
Merged PRs (30d)
16

Description

场景:
cellType: function ({ table, col, row }) {
  if (table.isAggregation(col, row)) {
    return "text";
  }
  return "checkbox";
}

cellType配置为函数时,某些单元格不需要渲染checkbox,比如示例代码中的合计栏。这个时候,表头的半选状态出现的不合理,如图所示:

Image
原因分析:

checkbox.tsinitCheckedState 函数初始化时对所有record都初始化了一个状态,而 updateHeaderCheckedState函数计算半选状态时,又没有排除掉。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/vtable/src/state/checkbox/checkbox.ts, reading initCheckedState and updateHeaderCheckedState. Reproduce the example with a cellType function that returns text for aggregation cells, then inspect how those records affect the header checkbox state. Done means the header's half-selected state reflects only cells that render checkboxes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
Half a day
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.