Skip to content

MudDataGrid: SCSS, Clean Up Sticky Columns#11800

Merged
ScarletKuro merged 3 commits intoMudBlazor:devfrom
versile2:fix/datagrid_11786
Aug 25, 2025
Merged

MudDataGrid: SCSS, Clean Up Sticky Columns#11800
ScarletKuro merged 3 commits intoMudBlazor:devfrom
versile2:fix/datagrid_11786

Conversation

@versile2
Copy link
Contributor

@versile2 versile2 commented Aug 16, 2025

Adjusted MudDataGrid and MudTable to include the mud-table-dense css selector on the thead element as well, allowing me to reduce overall scss burden and streamline SCSS problems with Sticky Headers.

Corrected Sticky column behavior, now filter row when ColumnFilterRow is selected sticks to the 2nd row of Sticky column and Loading sticks to the second or third row depending of ColumnFilterRow is used. Also now all 6 different modes respect the Dense property.

Resolves #11786

Visually tested all Docs for both MudTable and MudDataGrid in Docs.Server as well as UnitTests.Viewer

DataGridStickyColumns.mp4

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the style of this project.
  • I've added relevant tests or tested on existing ones.

versile2 and others added 2 commits August 15, 2025 17:17
- Added `mud-table-dense` to thead in MudTable and MudDataGrid
- Updated `_table.scss` with new styles for sticky headers and loading states, including conditional handling for dense layouts.
- Introduced `DataGridStickyHeaderTest.razor` to demonstrate sticky headers with a sample `MudDataGrid` setup, including loading and filter mode toggles.
@versile2 versile2 requested a review from Copilot August 16, 2025 08:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors sticky header functionality in MudDataGrid and MudTable components to improve SCSS organization and fix sticky column positioning issues. The changes address visual problems with sticky headers when using different table configurations.

  • Streamlined SCSS for sticky headers by consolidating duplicate rules and improving maintainability
  • Fixed sticky column positioning for filter rows and loading indicators across all table modes
  • Added proper Dense property support to table headers for consistent styling

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/MudBlazor/Styles/components/_table.scss Consolidated sticky header SCSS rules, removed duplicate dense-specific styles, and fixed positioning calculations for filter rows and loading indicators
src/MudBlazor/Components/Table/MudTableBase.cs Added Dense class to table header and cleaned up unused imports
src/MudBlazor/Components/DataGrid/MudDataGrid.razor.cs Added Dense class to DataGrid table header for consistency with MudTable
src/MudBlazor.UnitTests.Viewer/TestComponents/DataGrid/DataGridStickyHeaderTest.razor Added test component for visual verification of sticky header behavior across different configurations

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the SCSS for sticky headers in MudDataGrid and MudTable to improve maintainability and add support for dense mode. The changes centralize the sticky header logic, correctly apply the mud-table-dense class, and use the modern :has() CSS selector for more robust positioning. The code changes in the C# files are clean and align with the goal of the PR. My main feedback is on the SCSS file, suggesting improvements for clarity and maintainability by separating CSS rules and addressing hardcoded pixel values. Overall, this is a great improvement to the table components' styling.

@codecov
Copy link

codecov bot commented Aug 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.33%. Comparing base (06ded76) to head (63df70d).
⚠️ Report is 15 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #11800      +/-   ##
==========================================
- Coverage   91.34%   91.33%   -0.01%     
==========================================
  Files         468      468              
  Lines       14762    14764       +2     
  Branches     2877     2877              
==========================================
+ Hits        13484    13485       +1     
  Misses        636      636              
- Partials      642      643       +1     

☔ 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.

@sonarqubecloud
Copy link

@versile2 versile2 requested a review from vernou August 19, 2025 15:05
Copy link
Member

@vernou vernou left a comment

Choose a reason for hiding this comment

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

I am not good at CSS to review this changes.

I tested in local with the viewer. The bug is fixed and I found no problem.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended refactor Reorganizes code and has no changes to the API or functionality in the main library labels Aug 19, 2025
@versile2 versile2 requested a review from ScarletKuro August 25, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended refactor Reorganizes code and has no changes to the API or functionality in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataGrid Fixed header not visible if FilterMode is set to ColumnFilterRow

4 participants