collapseRow
Collapses the specified master table row. This hides its detail table row.
Parameters
row String|Element|jQuery
A string, DOM element or jQuery object which represents the master table row. A string is treated as a jQuery selector.
omitAnimations Boolean
If set to false, the detail template is hidden without animations.
Example - collapse the first master table row
<div id="grid"></div>
<script>
let encode = kendo.htmlEncode;
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
detailTemplate: ({ name, age }) => `<div>Name: ${encode(name)}</div><div>Age: ${encode(age)}</div>`
});
var grid = $("#grid").data("kendoGrid");
// first expand the first master table row
grid.expandRow(".k-master-row:first");
grid.collapseRow(".k-master-row:first");
</script>