Having a Telerik Grid for ASP.NET Core, how can I keep a column fixed (deny column resize)?
Especially, I have the last, "actions" column, not bound to the data, and that column has some buttons of fixed length. While the user is able to resize some other columns, the first one and the last one with actions, we don't want the user to resize.
This "solution" is NOK, because first of all it is not configurable from the .NET side, and also, I don't have a data binding to attach to, like "bar"
var grid = $("#grid").data("kendoGrid");
grid.resizable.bind("start", function(e) {
if ($(e.currentTarget).data("th").data("field") == "bar") {
e.preventDefault();
setTimeout(function(){
grid.wrapper.removeClass("k-grid-column-resizing");
$(document.body).add(".k-grid th").css("cursor", "");
});
}
});
My configuration is rather something like this:
columns.Select().Width(41).ClientHeaderTemplate(" ").Locked(); // lock does not mean Resize!
columns.Bound(c => c.Name).Sticky(true);
columns.Bound(c => c.FistsName).Width(80).MinResizableWidth(80);
columns.Bound(c => c.Etc).Width(60).MinResizableWidth(60);
columns.Bound(c => c.Etc).Width(85).MinResizableWidth(85);
columns.Command(command =>
{
command.Custom("CustomButtons").TemplateId("CommandsTemplate");
}).Width(92).Title("Actions"); // This one should be the last, and "locked" to resize