Skip to content

feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true#8057

Open
Tony-ST0754 wants to merge 1 commit into
mainfrom
feat-table-FixedColumn
Open

feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true#8057
Tony-ST0754 wants to merge 1 commit into
mainfrom
feat-table-FixedColumn

Conversation

@Tony-ST0754
Copy link
Copy Markdown
Collaborator

@Tony-ST0754 Tony-ST0754 commented May 26, 2026

feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true

Link issues

fixes #8056

问题描述 / Problem Description

当表格ShowLineNo属性为true,且表格中有列属性Fixedtrue时,FixedLineNoColumn该属性自动为true,以解决,当Table组件中显示行号,但未指定行号这列FixedLineNoColumn该属性,且默认为false,表格中又存在固定列,导致横向滑动时,左侧固定列会移动

解决方案 / Solution

  1. 当表格中除行号、扩展列之外,存在其他固定列时,且表格组件有显示行号,即ShowLineNo属性为true时,组件将FixedLineNoColumn属性自动设为true;
  2. 同时处理表格持久化后,表格有显示行号列且行号列FixedLineNoColumn属性没有设为true的问题

影响范围 / Impact

对老用户无影响

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Automatically fix the table line-number column when other columns are fixed and clarify related persisted state behavior.

New Features:

  • Automatically fix the line-number column when ShowLineNo is enabled and any data column is fixed.

Enhancements:

  • Ensure the line-number fixed behavior also works correctly with persisted table layouts.
  • Clarify documentation for FixedLineNoColumn behavior and table width persistence metadata.

…mn该属性自动为true

feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true
@bb-auto
Copy link
Copy Markdown

bb-auto Bot commented May 26, 2026

Thanks for your PR, @Tony-ST0754. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 26, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the Table component so that when row numbers are shown and any data column is fixed, the LineNo column automatically becomes fixed (including after state persistence), and clarifies related property documentation.

Sequence diagram for automatic LineNo column fixing in Table rendering

sequenceDiagram
    participant BlazorRenderer
    participant Table as TableComponent
    participant Column as TableColumn

    BlazorRenderer->>Table: RenderContentRow(item)
    loop ForEachVisibleColumn
        Table->>Column: Access Fixed
        alt ShowLineNo && Column.Fixed && !FixedLineNoColumn
            Table->>Table: FixedLineNoColumn = Column.Fixed
            Table->>Table: StateHasChanged()
        end
        Table->>BlazorRenderer: RenderContentCell(context)
    end
Loading

File-Level Changes

Change Details Files
Auto-fix LineNo column when ShowLineNo is enabled and any column is fixed, including during persisted state rendering.
  • Within row rendering, detect when ShowLineNo is true, a column is fixed, and FixedLineNoColumn is false, then set FixedLineNoColumn to true
  • Trigger StateHasChanged after auto-setting FixedLineNoColumn to ensure correct behavior when loading persisted configurations
  • Minor formatting tweak in the content-row rendering loop
src/BootstrapBlazor/Components/Table/Table.razor.cs
Document the new auto-fix behavior on the FixedLineNoColumn parameter.
  • Update Chinese and English XML doc comments for FixedLineNoColumn to state that it automatically becomes true when there are fixed columns in the table
src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Clarify semantics of TableWidth in client status persistence.
  • Adjust XML doc comments to explain that TableWidth = 0 means the table width is auto-sized
src/BootstrapBlazor/Components/Table/TableColumnClientStatus.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#8056 When the table has ShowLineNo = true and at least one column with Fixed = true, automatically set FixedLineNoColumn to true so that the line number column is fixed during horizontal scrolling.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot requested a review from ArgoZhang May 26, 2026 14:35
@bb-auto bb-auto Bot added the enhancement New feature or request label May 26, 2026
@bb-auto bb-auto Bot added this to the v10.6.0 milestone May 26, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The logic that sets FixedLineNoColumn and calls StateHasChanged() inside RenderContentRow introduces side effects during rendering and risks unnecessary re-renders or render loops; consider computing this once (e.g., in OnParametersSet/OnAfterRender) based on the column metadata instead of mutating state from within the cell render loop.
  • FixedLineNoColumn is a [Parameter] but is being mutated inside the component; if consumers can set this parameter explicitly, it would be clearer either to treat it as internal state (with a backing field) or to introduce a separate internal flag so the component does not overwrite a value controlled by the parent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logic that sets `FixedLineNoColumn` and calls `StateHasChanged()` inside `RenderContentRow` introduces side effects during rendering and risks unnecessary re-renders or render loops; consider computing this once (e.g., in `OnParametersSet`/`OnAfterRender`) based on the column metadata instead of mutating state from within the cell render loop.
- `FixedLineNoColumn` is a `[Parameter]` but is being mutated inside the component; if consumers can set this parameter explicitly, it would be clearer either to treat it as internal state (with a backing field) or to introduce a separate internal flag so the component does not overwrite a value controlled by the parent.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b58289b) to head (3d5ed5e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8057   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          766       766           
  Lines        34157     34164    +7     
  Branches      4697      4698    +1     
=========================================
+ Hits         34157     34164    +7     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Table): 当表格ShowLineNo属性为true,且表格中有列属性Fixed为true时,FixedLineNoColumn该属性自动为true

2 participants