Disable Resizing for Specific Columns
Environment
Product | Progress Kendo UI Grid for jQuery |
Operating System | Windows 10 64bit |
Preferred Language | JavaScript |
Description
How can I disable column resizing for specific columns in the Kendo UI Grid for jQuery?
Solution
Column resizing is enabled or disabled for all Grid columns.
The following example demonstrates how to prevent resizing for the "bar" column.
<p>The <strong>bar</strong> column cannot be resized:</p>
<div id="grid"></div>
<script>
$(function(){
$("#grid").kendoGrid({
dataSource: {
data: [
{foo: "foo 1", bar: "bar 1", baz: "baz 1"},
{foo: "foo 2", bar: "bar 2", baz: "baz 2"}
]
},
resizable: true
});
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", "");
});
}
});
});
</script>