I have the following js function that is called during the dataBound event of the parent grid to remove any hierarchal cells, for readability of the users. So they don't have to expand every row to see that there is no data.
It works as it should when the page loads, the issue comes when the parent grid is either filtered or on page change. When the grid populate the rows they now have the expand icon in the hierarchy-cell. I've tried several things but these elements always appear after any operation on the parent grid.
Is there some way to keep these removed from the parent grid?
function removeHierarchyCell() {
var data = $('#GridName').data('kendoGrid').dataSource.data();
// Remove row expansion when no data
$.each(data, function (i, row) {
var hasChildren = row.get("ChildModel");
if (hasChildren === null || hasChildren === undefined || hasChildren.length == 0) {
$('tr[data-uid="' + row.uid + '" ] ').find(".k-hierarchy-cell a").remove();
}
});
}Is there some way to keep these removed from the parent grid?