Resizing of last column

Hello,
I cannot resize the last column in SfGrid by dragging the edge line. The one before the last can be extended and the whole grid also extends. However the last one can be only shrinked and finally disappears. Is there any way to make it working correctly?
Best regards

5 Replies 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team February 17, 2021 01:24 PM UTC

Hi Andrzej, 

Query: Resizing of last column  

We have validated your query and we suggest you to set the MinWidth property to GridColumn. This will prevent the column to completely hidden. You can make the last column larger using edge line of the column. 

<SfGrid DataSource="@GridData" Height="400" AllowResizing="true"> 
                <GridColumns> 
                    <GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right"  MinWidth="120" Width="200" MaxWidth="300"></GridColumn> 
                    . . . 
                    <GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" MinWidth="8" Width="200"></GridColumn> 
                    <GridColumn Field=@nameof(OrdersDetails.ShipCity) HeaderText="Ship City" MinWidth="8" Width="200"></GridColumn> 
                </GridColumns> 
</SfGrid> 

Reference: 

Please let us know if you have any concerns. 

Regards, 
Rahul  


Marked as answer

AN Andrzej February 17, 2021 03:10 PM UTC

Hi Rahul,
If the AllowPaging="false" then there is a space in a header above vertical scroll bar which allows to resize the last column. However if the AllowPaging="true" then there is no scroll bar and no additional space present. And then there is no way to resize the last column. Do you have any hint how to modify the grid to make it possible also with paging allowed?
Best regards


RN Rahul Narayanasamy Syncfusion Team February 18, 2021 12:56 PM UTC

Hi Andrzej, 

Thanks for the update. 

We have validated your query with the provided information and we suggest you to set Height property to Grid. So the scrollbar space will be in visible. You can resize the last column by using edge line of the column. Find the below code snippets for your reference. 

 
<SfGrid DataSource="@Orders" AllowResizing="true" AllowPaging="true" Height="500"> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        . . . 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.ShipCountry) HeaderText="Ship Country" MinWidth="10" Width="150"></GridColumn> 
    </GridColumns> 
</SfGrid> 

Please let us know if you have any concerns. 

Regards, 
Rahul 



AN Andrzej February 22, 2021 04:37 PM UTC

Thanks for the hint to set a fixed height for the grid. Then the scroll bar is always visible which allows to modify the width of last column. Not easy but at least it works.

There is one doubt. How could I set the fixed height to be accurate according to the contents of data-pages. Not too high (which leaves empty space after last row) and not to small so all data rows are visible in paging mode without scrolling (AllowPaging="true"). Is there any way to obtain it?

Best regards


RN Rahul Narayanasamy Syncfusion Team February 23, 2021 01:44 PM UTC

Hi Andrzej, 

Thanks for the update. 

We have validated your query and we suggest you to refer the below documentation for your reference. In this documentation, PageSize is calculated based on the datagrid height by using the OnLoad event. So based on the provided height, the page size is set in the Grid.  

Reference: 

Please let us know if you have any concerns. 

Regards, 
Rahul 


Loader.
Up arrow icon