Difficulty with hidecolumn

Hello,

I don't have much knowledge with JavaScript, I'm not able to hide columns with the hidecolumn.

My code is very similar to this
https://stackblitz.com/edit/jnmbmc-1mj6qu?file=index.js

I would also like to add a column to this example static text.

Thanks

2 Replies 1 reply marked as answer

TH Thiago August 7, 2020 07:42 PM UTC

I did it, the problem is that I was writing the wrong column name.

My Error
taskFields: {
      id: 'TaskID',
      name: 'TaskName',
},
columns: [
     { field: 'taskid', visible: false},
],

Thanks




PP Pooja Priya Krishna Moorthy Syncfusion Team August 10, 2020 08:05 AM UTC

Hi Thiago, 
Absolutely, defining the wrong field name in the columns property was the problem in hiding the ‘TaskID’ column in load time. We can also dynamically hide and show the column using hideColumn and showColumn public method  respectively. 
Please find the below code example. 

<button id="hide">Hide</button> 
  document.getElementById('hide').addEventListener('click', function () { 
     ganttChart.hideColumn('TaskID', 'field'); 
}); 


Regards, 
Pooja K. 


Marked as answer
Loader.
Up arrow icon