I've had this issue for years with the Telerik grid when trying to use the built in ColumnMenu in the same grid as template columns. I want to make a template column for a custom button. The column and button work fine, however if the template column is not the last column in the grid it causes the ColumnMenu items to all be off by one. ie: you click one of the columns to hide it in the ColumnMenu and it will hide the one above it in the list instead. It's like the column menu doesnt know to account for the template columns.
The only workaround I've found is to place the template column as the last column in the grid or to make a bound column and set its title to a blank and set sorting/paging both false, however this still then leaves a blank entry in the column menu and is not desirable. Am I missing something when using template columns and the ColumnMenu in the same grid?
Code for my template column:
columns.Template("<button type=\"button\" class=\"btn btn-grid\" data-id=\"#=Id#\"><i class=\"fas fa-fw fa-pencil-alt\"></i></button>");
Heres is some code of a grid (I chopped a lot of code out of this grid to simplify it and verified this still has the issue), all of my grids across many projects share this issue. This grid is using version 2020.2.617 and the bootstrap theme.
@(Html.Kendo().Grid<TagGridViewModel>().Name("gridTags").Columns(columns =>
{
columns.Template("<button type=\"button\" class=\"btn btn-grid\" data-id=\"#=Id#\"><i class=\"fas fa-fw fa-pencil-alt\"></i></button>");
columns.Bound(c => c.TagId).Filterable(f => f.Cell(cell => cell.ShowOperators(false).SuggestionOperator(FilterType.Contains).MinLength(2))).ClientTemplate($"<a class=\"grid-link\" href=\"{Url.Action("Details", "Tags")}/#=Id#\">#:{nameof(TagGridViewModel.TagId)}#</a>");
columns.Bound(c => c.AddDate).Filterable(false);
columns.Bound(c => c.UpdateDate).Title("Updated").Filterable(false).ClientTemplate($"#={nameof(TagGridViewModel.UpdateDateDisplay)}#");
})
.ColumnMenu(true)
.DataSource(dataSource => dataSource.Ajax().PageSize(25)
.ServerOperation(false)
.Read(read => read.Action("DetailsTagsGridRead", "Clients", new { clientId = Model.Location.ClientId, locationId = Model.Location.Id }))
.Events(events => events.Error("gridError"))
)
)