
Hi,
how to Show/Hide Detail row on condition with value from grid datasource?
robert
6 Answers, 1 is accepted
Hello Robert,
You can use the Grid DataBound event and create a function that iterates through the rows and expand their detail row based on a condition:
dataBound: function(e) {
var that = this;
var rows = e.sender.tbody.children();
for (var j = 0; j < rows.length; j++) {
var row = $(rows[j]);
var dataItem = e.sender.dataItem(row);
var country = dataItem.get("Country");
if (country == "USA") {
that.expandRow(row);
}
}
},
I have created the following Dojo demonstrating the suggested behavior:
https://dojo.telerik.com/obUQOVuk
I hope this helps!
Regards,
Teya
Progress Telerik

Hello,
I don't want to expand a proview row but I want to hide (completely) a specific preview row!
robert
Hello Robert,
By preview row do you mean a detail row or a grid row? By default, the detail rows are hidden, so, unfortunately, I cannot understand your requirements. You can take a look at the following Knowledge Base article on how to expand and collapse all rows and adjust the logic to work for your case:
https://docs.telerik.com/kendo-ui/knowledge-base/grid-how-to-expand-and-collapse-details-rows
Regards,
Teya
Progress Telerik

found it - thanks...
var that = this;
var rows = e.sender.tbody.children();
for (var j = 0; j < rows.length; j++) {
var row = $(rows[j]);
var dataItem = e.sender.dataItem(row);
if (dataItem) {
var ebene = dataItem.get("Mitgliedebene");
if (ebene === true) {
row.find(".k-hierarchy-cell").html("");
that.collapseRow(row);
} else {
that.expandRow(row);
}
}
}

please do you have answer for this Q
https://www.telerik.com/forums/hide-the-column-based-on-viewdata#TJPxGf35vkmP3-Y09IZD-Q
Hi Mohammed,
Since there is a separate forum thread open for the linked issue, let's keep the conversation regarding it in the other thread to avoid confusion.
Thank you for understanding.
Regards,
Teya
Progress Telerik