radzenhq / radzen-blazor

Radzen Blazor is a set of 90+ free native Blazor UI components packed with DataGrid, Scheduler, Charts and robust theming including Material design and FluentUI.
https://www.radzen.com
MIT License
3.49k stars 782 forks source link

DataGrid column resize issue => resize other columns too #1031

Closed Delriarh closed 1 year ago

Delriarh commented 1 year ago

Hey !

I have encountered an issue with DataGridColumn width... I succeeded to reproduce it and found a way to avoid it...

1) I created an Editable DataGrid with resizable columns, within a container large enough to contain all the columns => NO HORIZONTAL SCROLL BAR 2) Width of all columns are initialized with Width="...px" 3) I put the Edit button on the first column, with Frozen="true". The other columns are not frozen 4) Therefore, when I want to resize a column, it changes the width of the others too, in order to adapt to the width of the DataGrid, without adding any horizontal scroll bar ! This is not what I excepted, as I just wanted to modify 1 column

Solution to avoid this issue : force the initial width of the columns, in order to get the HORIZONTAL SCROLL BAR at the creation of the DataGrid

Thanks for all the work you're doing here, it's very helpful !!

Regards Erwan

Here is the options of my DataGrid (I tried with ColumnWidth, it was the same) : <RadzenDataGrid @ref="xxx" AllowFiltering="true" AllowColumnResize="true" AllowAlternatingRows="true" FilterMode="FilterMode.Simple" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" AllowSorting="true" PageSize="13" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" EditMode="DataGridEditMode.Single" Data="@xxx" TItem="xxx" LogicalFilterOperator="LogicalFilterOperator.And" RowUpdate="@OnUpdateRow" Sort="@Reset" Page="@Reset" Filter="@Reset">

enchev commented 1 year ago

You need to specify style="width:XXXpx" if you want to get horizontal scrollbar after column resize.

Ayymoss commented 9 months ago

It's still bugged, but it's problematic on the https://blazor.radzen.com/datagrid-column-resizing reference.

Note that the column's resize is travelling further than the cursor position, similarly resizing a column will resize the neighbour.

nxkg3g3

Better reference here: https://github.com/radzenhq/radzen-blazor/issues/1308