kendo grid hide column dynamically

1 Answer 9265 Views
Grid
Bertha
Top achievements
Rank 1
Bertha asked on 19 Jan 2015, 04:54 PM
I tried to hideColumn(k) in databound event when the whole column has null values. But because my first row of header is colspan of 6 columns, so it did not hide properly.  I could only hide the first column or the second column (contains all the columns).  I tried grid.columns[1].hideColumn(3) but failed as hideColumn is related to grid. 
How can I achieve that?

columns: [
{ field: "facname", title: "Facility", attributes: { style: "text-align:left" }, width: "200px" },
{
title: "",
columns: [
{ field: "envelopes[0]", title: "Food", attributes: { style: "text-align:right" }, width: "90px", template: "#= envelopes[0] == null ? '-' : kendo.toString(envelopes[0], 'c0') #" },

Thanks.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Jan 2015, 03:09 PM
Hello Bertha,

There are three ways to hide and show columns, depending on what method argument you use (column index, field name or column object). Please use a field name or an object.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-hideColumn

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Bertha
Top achievements
Rank 1
commented on 21 Jan 2015, 03:52 PM

Thanks.  Exactly what I need.
Tags
Grid
Asked by
Bertha
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or