# Visible property of a GridColumn

**URL:** <https://community.datagrok.ai/t/visible-property-of-a-gridcolumn/429>\
**Category:** Issues\
**Created:** [November 6, 2020, 8:45pm UTC](https://community.datagrok.ai/t/visible-property-of-a-gridcolumn/429 "2020-11-06T20:45:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpetrov.datagrok.ai](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@dpetrov.datagrok.ai](https://community.datagrok.ai/u/dpetrov.datagrok.ai)\
**Post date:** [November 6, 2020, 8:45pm UTC](https://community.datagrok.ai/t/visible-property-of-a-gridcolumn/429/1 "2020-11-06T20:45:14Z")

</div>

Setting the “visible” property on a GridColumn to false correctly hides the column, but setting it back to true doesn’t seem to make the column visible. In the following snippet clicking anywhere on the grid’s header should toggle the visibility state of the first column, but it only works one way. Calling the grid’s runPostponedComputations() method doesn’t help either.

let nRowCount = 1000;  
let nColCount = 100;  
let grid = grok.shell.addTableView(grok.data.demo.randomWalk(nRowCount, nColCount)).grid;

```
rxjs.fromEvent( grid.overlay, 'click').subscribe((e) => {

    let nButton = e.button;
    if (nButton === 0)
    {
        let cell = grid.hitTest(e.offsetX, e.offsetY);
        if (cell.isColHeader) {
            let colFirst = grid.columns.byIndex(1);
            colFirst.visible = !colFirst.visible;
           }
   }
});
```

---

<div class="post-metadata">

**Author:** ![skalkin](https://community.datagrok.ai/user_avatar/community.datagrok.ai/skalkin/32/5_2.png) [@skalkin](https://community.datagrok.ai/u/skalkin)\
**Post date:** [November 9, 2020, 3:58pm UTC](https://community.datagrok.ai/t/visible-property-of-a-gridcolumn/429/2 "2020-11-09T15:58:32Z")

</div>

Thanks for reporting! We’ve fixed the issue, the fix will be deployed on the dev server in 30 minutes.

---

<div class="post-metadata">

**Author:** ![skalkin](https://community.datagrok.ai/user_avatar/community.datagrok.ai/skalkin/32/5_2.png) [@skalkin](https://community.datagrok.ai/u/skalkin)\
**Post date:** [November 9, 2020, 4:39pm UTC](https://community.datagrok.ai/t/visible-property-of-a-gridcolumn/429/3 "2020-11-09T16:39:52Z")

</div>

By the way, we really appreciate your code snippets that reproduce the issues, it helps a lot, thanks! May I suggest a slight improvement?

```auto
let grid = grok.shell.addTableView(grok.data.demo.randomWalk(100, 100)).grid;
ui.dialog()
  .add(ui.button('Toggle', () => grid.columns.byIndex(1).visible = !grid.columns.byIndex(1).visible))
  .show();

```
