-
-
Notifications
You must be signed in to change notification settings - Fork 999
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
Feat/row class name #1031
Feat/row class name #1031
Conversation
This is my first ever PR so my apologies for any mistakes or errors. I tried to follow the guidelines provided to the best of my ability. |
Codecov Report
@@ Coverage Diff @@
## master #1031 +/- ##
=========================================
- Coverage 5.49% 5.49% -0.01%
=========================================
Files 424 426 +2
Lines 23095 23128 +33
=========================================
Hits 1270 1270
- Misses 21825 21858 +33
Continue to review full report at Codecov.
|
Thank you for you contribution @mostrowski123 It's very nice. |
components/table/Table.razor
Outdated
@@ -184,7 +184,7 @@ RenderFragment<(Table<TItem> table, bool header)> colGroup = ctx => | |||
} | |||
@if (!hasChildren && table.ExpandTemplate != null && table.RowExpandable(currentRowData)) | |||
{ | |||
<tr class="ant-table-expanded-row ant-table-expanded-row-level-1" style="@(currentRowData.Expanded?"":"display: none;")"> | |||
<tr class="ant-table-expanded-row ant-table-expanded-row-level-1 @table.RowClassName(currentRowData)" style="@(currentRowData.Expanded?"":"display: none;")"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* feat(module: table): add row styling * docs: add RowClassName to docs * docs: add custom row style subtext * feat(module: table): add ExpandedRowClassName * remove RowClassName for expand row * add chinese doc Co-authored-by: ElderJames <shunjiey@hotmail.com>
* feat(module: table): add row styling * docs: add RowClassName to docs * docs: add custom row style subtext * feat(module: table): add ExpandedRowClassName * remove RowClassName for expand row * add chinese doc Co-authored-by: ElderJames <shunjiey@hotmail.com>
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
#1025
💡 Background and solution
There currently is no way of conditionally applying styles to rows in a table. This is useful if you want to highlight a row conditionally based on the row data.
I fixed this by adding a
Func<RowData<TItem>, string> RowClassName
parameter to the table component and queried its value in the class attribute where rows are created.📝 Changelog
I should note there is an issue when hovering on the highlighted rows as the hover color overrides the any color set by the custom style. I am not sure if this is acceptable or not, but I was unable to find a way to darken the color that is set. My apologies.
☑️ Self Check before Merge