GridColumn MinWidth not working

Version 25.1.35


I have a SfGrid where every column has a "Width" value set in pixels, except for one "Comment" column.  the comment column adjusts to fit the grid width based on the screen size which is as expected.

However, I want the comment column to have a minimum width so that it doesn't disappear on smaller screens. I set the MinWidth property to "200px"  and also tried "200" but this has no effect - the column still shrinks to zero.

I would expect the column to shrink and grow based on the size of the grid, but since the MinWidth is set to 200 I would expect that the column is always at least 200px wide, but that is not happening. Why?  It feels like a bug.


Large screen:

chrome_KLxt1Fhn8Z.png

Small screen (Comment should still be at least 200px wide but instead it is :

chrome_ve3pGiom4z.png


Code:

 <SfGrid @ref=grid DataSource="@plan.Items.Where(x=>x.Alive)">

     <GridEvents TValue="ProdPlanItem"></GridEvents>

     <GridColumns>

         <GridColumn Field=@nameof(ProdPlanItem.Id) IsPrimaryKey="true" Visible="false" />


         <GridColumn Field=@nameof(ProdPlanItem.StartDate) Width="140px" HeaderText="Start">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     <SfTimePicker TValue="DateTime" Format="HH:mm:ss" @bind-Value="item.StartDate">

                         <TimePickerEvents TValue="DateTime" ValueChange="(x)=>DB.AutoSaveDate(x,plan)"></TimePickerEvents>

                     </SfTimePicker>

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.EndDate) Width="140px" HeaderText="End">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     if (item.EndDate == DateTime.MinValue) {

                         <span class="e-icons e-clock" />

                     }

                     else {

                         <SfTimePicker TValue="DateTime" Format="HH:mm:ss" @bind-Value="item.EndDate" Min="item.StartDate">

                             <TimePickerEvents TValue="DateTime" ValueChange="(x)=>DB.AutoSaveDate(x,plan)"></TimePickerEvents>

                         </SfTimePicker>

                     }

                 }

             </Template>

         </GridColumn>


         <GridColumn Field="mins" Width="50px" HeaderText="Mins">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     if (item.StartDate != DateTime.MinValue && item.EndDate != DateTime.MinValue) {

                         <div>@((item.EndDate - item.StartDate).TotalMinutes.ToString("0"))</div>

                     }

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.MetalLink) Width="200px" HeaderText="Material">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     @if (MetalList != null) {

                         <SfDropDownList TItem="Metal" TValue="int" DataSource="MetalList" @bind-Value=item.MetalLink Enabled="item.ActivityLink==0">

                             <DropDownListFieldSettings Text="MetalGrade" Value="Id"></DropDownListFieldSettings>

                             <DropDownListEvents TValue="int" TItem="Metal" ValueChange="(x)=>DB.AutoSaveList<Metal>(x, item)" />

                         </SfDropDownList>

                     }

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.ActivityLink) Width="200px" HeaderText="Activity">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     @if (ActivityList != null) {

                         <SfDropDownList TItem="ActivityUM" TValue="int" DataSource="ActivityList" @bind-Value=item.ActivityLink Enabled="item.MetalLink==0">

                             <DropDownListFieldSettings Text="Title" Value="Id"></DropDownListFieldSettings>

                             <DropDownListEvents TValue="int" TItem="ActivityUM" ValueChange="(x)=>DB.AutoSaveList<ActivityUM>(x, item)" />

                         </SfDropDownList>

                     }

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.WeightLbs) Width="100px" HeaderText="LBS">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     <SfNumericTextBox TValue="double" @bind-Value=item.WeightLbs ShowSpinButton=false Format="0.#">

                         <NumericTextBoxEvents TValue="double" ValueChange="(x)=>SaveLbs(x, item)"></NumericTextBoxEvents>

                     </SfNumericTextBox>

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.WeightNt) Width="100px" HeaderText="NT">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     <SfNumericTextBox TValue="double" @bind-Value=item.WeightNt ShowSpinButton=false Format="0.##">

                         <NumericTextBoxEvents TValue="double" ValueChange="(x)=>SaveNT(x, item)"></NumericTextBoxEvents>

                     </SfNumericTextBox>

                 }

             </Template>

         </GridColumn>


         <GridColumn Field=@nameof(ProdPlanItem.Comment) MinWidth="200px">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     <SfTextBox @bind-Value=item.Comment ValueChange="(x)=>DB.AutoSaveText(x,item)"></SfTextBox>

                 }

             </Template>

         </GridColumn>


         <GridColumn Field="del" Width="75px" HeaderText="">

             <Template>

                 @{

                     var item = context as ProdPlanItem;

                     <SfButton IconCss="e-icons e-trash" CssClass="bg-danger" OnClick="()=>DeleteItem(item)"></SfButton>

                 }

             </Template>

         </GridColumn>

     </GridColumns>

 </SfGrid>


5 Replies

MS Monisha Saravanan Syncfusion Team September 25, 2024 09:34 AM UTC


Hi Ryan,


Greetings from Syncfusion.


We have considered your request as improvement “MinWidth is not maintained while performing Browser Resize” At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest and this improvement will be included in any of our upcoming release.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.


MinWidth is not maintained while performing Browser Resize in Blazor | Feedback Portal (syncfusion.com)


You can communicate with us regarding the open features at any time using the above Feature Report page.


Regards,

Monisha




RT Ryan Tomko September 25, 2024 02:27 PM UTC

I'm not talking about a Browser Resize issue.  The MinWidth is not maintained when browser starts at the narrow size, there is no need to do a browser resize to see the issue.  Isn't this a bug?  If not, then how is MinWidth supposed to work? It appears that MinWidth has no effect.



PS Prathap Senthil Syncfusion Team September 27, 2024 03:58 AM UTC

Based on the reported problem, we would like to clarify that we do not support maintaining the MinWidth during browser resizing. Currently, browser-based rendering does not have support for this feature, so we have planned to consider it as an improvement. For further information, we suggest following up on the feedback mentioned above. Thank you for your understanding.



RT Ryan Tomko September 27, 2024 02:03 PM UTC

There is a confusion or misunderstanding here.  This issue has nothing to do with browser resizing. I repeat, resizing the browser is NOT the problem.  There is no need to resize the browser to see the issue I reported above.


To clarify, the problem is that when the grid I defined above is viewed on a small screen (such a a table) the "Comment" column is not visible at all. I would expect the "Comment" column to be 200px wide because the MinWidth is 200px.   It appears that the MinWidth property does nothing.    This has nothing to do with resizing the browser, because the browser starts with a narrow width and stays at that width for the entire duration - there is no resizing taking place. The problem is that the MinWith is not keeping the column at least 200px on a small screen.


Why is the "Comment" column not 200px when my above example is viewed on a small tablet screen?



PS Prathap Senthil Syncfusion Team September 30, 2024 10:15 AM UTC

Yes, we have considered the issue when resizing the browser to a small size, as well as when initially rendering the grid on small devices. Once we have completed the task, we will inform you. Until then, we appreciate your patience. Thank you for your understanding.



Loader.
Up arrow icon