This is a migrated thread and some comments may be shown as answers.

Kendo Grid column hiding goes haywire when using row template

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sonali
Top achievements
Rank 1
Veteran
Sonali asked on 28 Apr 2020, 12:03 PM

I am using a row template script in my kendo grid. By default, I want some columns to be hidden using the hidden: true property. When the grid is rendered, the column header of the hidden column does not appear, but the row data is still present. Here's a dojo showing my problem: https://dojo.telerik.com/IjUkuLAw

I also tried passing my column object as parameter to the template and then using some if-else condition inside it. This surely hides the column, but then if I want to hide any other column or show the previously hidden column using the columnMenu and then refresh the grid, the same problem arises. Here's an example: https://dojo.telerik.com/oMokUMUT/3

Also, I don't want to use any column template and would want to use the row template itself.

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 30 Apr 2020, 10:38 AM

Hello,

One possible approach in this case is to refresh the cols array just before we refresh the Grid as for example it is done in the code below:

  $("#b1").on("click", function(){
     cols = grid.columns;
     grid.refresh();
     
   });

This will allow the rowTemplate to correctly show the values of the row - here is a sample dojo.

Regards,
Plamen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Sonali
Top achievements
Rank 1
Veteran
Answers by
Plamen
Telerik team
Share this question
or