MudTable: Add CellClass parameter#10884
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #10884 +/- ##
==========================================
- Coverage 91.01% 90.99% -0.03%
==========================================
Files 429 429
Lines 13932 13934 +2
Branches 2691 2693 +2
==========================================
- Hits 12680 12679 -1
Misses 649 649
- Partials 603 606 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
danielchalmers
left a comment
There was a problem hiding this comment.
We shouldn't add a new type of property as our density system is already too disjointed, but we do have a Margin enum for this purpose and I think deprecating Dense and replacing it with that could work. Though it would imply zero padding, not lower (allowing the user to add their own).
|
@danielchalmers I've made a few changes. First, I've undone all previous modifications. I added a public class Density
{
public string PaddingStep { get; set; } = "4px";
}... public MudTheme()
{
Density = new Density();
PaletteLight = new PaletteLight();
PaletteDark = new PaletteDark();
Shadows = new Shadow();
Typography = new Typography();
LayoutProperties = new LayoutProperties();
ZIndex = new ZIndex();
PseudoCss = new PseudoCss();
} |
|
Thanks for testing that - I think we need a more top-down approach with several components, but it would have to be saved for a major release regardless since it's a breaking change. I talked to @Garderoben and we think the simplest solution would be to use It would mean adding the same class to each cell, so a new property (e.g. |
Totally agree with you.
Thanks for discussing this with @Garderoben and for the snippet!
Please take a look at https://try.mudblazor.com/snippet/GamfamvrcrAaNSPm. A common class is used to define cells for <MudTable CellClass="mud-table-small-cell"...> |
I've undone all previous changes. I've added a PS: I've also modified three unit tests to take into account the changes brought about by this implementation. |
|
+1 for CellClass. Look at https://mudblazor.com/components/datagrid#visual-styling for comparison. Although we might not want all the |
|
I like it, this is much better! But lets not forget about DataGrid, i would like to have CellClass in there as well then since its very similar. Or what do you say @henon @danielchalmers |
DataGrid has it already and in fact has even better styling suppport. I was suggesting the opposite, getting everything that datagrid supports supported in table as well (except the Style variants, we decided not to add any more Style properties and we may even remove them in the future). |
|
On a side note, the The advantage to define the One solution could be to do the following, for consistency : A - Rename What do you think? Or keep this PR as it is? Or another solution ? |
|
MudGrid is column based and MudTable is not. They have a different design philosophy and so I think we're fine with the different behavior of CellClass. So I would not change MudGrid, meaning I'd not do A and B. If you want to add C in this PR you are welcome to do so. If you don't have the time then just add CellClassFunc. It should have parameters to identify the row and column of the table so could theoretically have a different style for every cell in the table. I guess the func would also differ from MudGrid because the grid does not need information about the column as a parameter in the func. |
|
Will leave this to @henon |
|









Description
When many columns need to be displayed in a table, even using the
Denseparameter, the table is too wide horizontally. This can be a problem with certain screen sizes. This is why I propose theUltraDenseparameter, which makes the display of data in the table even more compact.The
UltraDenseparameter takes precedence over theDenseparameter when set totrue.An example has been added in the TablePager Customization section and offers the possibility to compare the usage of
DenseandUltraDenseparameters.How Has This Been Tested?
It has been tested visually. With added sorting, fixed header or comparison of the use of the
Denseparameter.Type of Changes
Checklist
dev).