Can a column be excluded from minScreenWidth after the column has been shown/hidden from column menu

1 Answer 77 Views
Grid
Tuomo
Top achievements
Rank 1
Tuomo asked on 13 Oct 2023, 09:49 AM

Hi,

We have some grievances with screen width and column showing. The problem is that columns keep getting hidden/shown after they have been manually set hidden or not from column menu when screen width is adjusted afterwards. 

@(Html.Kendo().Grid<>(TestModel)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.1).Title("Test1");
        columns.Bound(p => p.Test2).Title("Test2");
        columns.Bound(p => p.Test3).Title("Test3").MinScreenWidth(1000);
})...

Here when screen width is for example 900 and then Test3 column is set to show from column menu Test3 column would show for now. But when after changing screen width the column would hide automatically.

Is there a way to ignore minScreenWidth option for columns after they have been manually set visible or hidden from column menu?

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 18 Oct 2023, 06:32 AM

Hello Tuomo,

Thank you for the code snippet and the details provided.

In order to achieve the desired behavior, I would recommend using a JavaScript function that will remove the "minScreenWidth" property of the column.

For example, if we have a column named "ShipName" with "MinScreenWidth" set to 1000:

columns.Bound(p => p.ShipName).MinScreenWidth(1000);
The result in the columns in the Grid will be:

Handle the click of the column in the ColumnMenu and remove the minScreenWidth property.

I hope this information helps. Let me know if further information or assistance is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Tuomo
Top achievements
Rank 1
commented on 18 Oct 2023, 07:40 AM

Thank you for the answer. We decided to just remove most minScreenWidth properties from the grids for now. It would be a bit tricky for users to go through multiple columns needing manual clicking for larger grids to get it right.
Anton Mironov
Telerik team
commented on 19 Oct 2023, 05:31 AM

Hi Tuomo,

Thank you for sharing this case with the community.

If further information or assistance is needed, do not hesitate to contact me, the Team, and the comminuty.


Best Regards,
Anton Mironov

Tags
Grid
Asked by
Tuomo
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or