Tyson Gibby
Tyson Gibby

Reputation: 4660

How to set a minimum width for MudBlazor MudDataGrid columns?

I need to set a minimum width for the some of the columns in my MudBlazor MudDataGrid.

I could not find an option in the MudDataGrid column component and even when I set a minimum width in the CSS style property of the column component there was no change to the width.

How do I go about setting a minimum width for the MudDataGrid columns that need it?

<MudDataGrid T="Car" Items="@Cars" Sortable="true" Filterable="false" Outlined="true">
    <Columns>
        <Column T="Car" Field="Description" Sortable="false" Title="Description" Style="min-width: 1000px"/> 
    </Columns>
    <PagerContent>
        <MudDataGridPager T="Car" />
    </PagerContent>
</MudDataGrid>

Upvotes: 3

Views: 4530

Answers (1)

Dimitris Maragkos
Dimitris Maragkos

Reputation: 11342

You have to set the CellStyle parameter of the Column.

<Column CellStyle="min-width: 1000px;" T="Car" Field="Description" Sortable="false" Title="Description" /> 

https://try.mudblazor.com/snippet/QEmxOlYHCztUtxRO

Upvotes: 4

Related Questions