# Ignition vision hide a colomn from script

**URL:** <https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 30, 2020, 5:04pm UTC](https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177 "2020-10-30T17:04:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yzhang](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yzhang](https://forum.inductiveautomation.com/u/yzhang)\
**Post date:** [October 30, 2020, 5:04pm UTC](https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177/1 "2020-10-30T17:04:33Z")

</div>

Hi, I am using a power table in ignition, and I like the fact that I can let my user to choose to hide or show a colomn, my problem is when I want to:

1. give my user the choice of showing or hiding a column named **id\_list** , and also
2. hide that column by default

I think I will need to put it in a event handler, like if the page is openned, then I will hide the selected column by default, user can still right click the colomn headers and choose to show that specific colomn. Can someone tell me where to put this script and what will be the script? Thanks.

After doing some search and reading, I think the best place to put the scipt will be the **initialize** extension function, but I am still searching on how to refer to this column and put it’s hide property to True.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 30, 2020, 7:02pm UTC](https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177/2 "2020-10-30T19:02:11Z")

</div>

I usually build popup menus for that.  
Put something like this on the onPopupTrigger extension function.

```
def hideColumn0(evt, cellValue=value):
	table = self
	columnData = table.columnAttributesData
	newData = system.dataset.setValue(columnData, 0, 'hidden', 1)
	table.columnAttributesData = newData
def showColumn0(evt, cellValue=value):
	table = self
	columnData = table.columnAttributesData
	newData = system.dataset.setValue(columnData, 0, 'hidden', 0)
	table.columnAttributesData = newData
menu = system.gui.createPopupMenu({'Hide ID Column':hideColumn0,'Show ID Column':showColumn0})
menu.show(event)
```

---

<div class="post-metadata">

**Author:** ![yzhang](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yzhang](https://forum.inductiveautomation.com/u/yzhang)\
**Post date:** [October 30, 2020, 10:49pm UTC](https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177/3 "2020-10-30T22:49:37Z")

</div>

> [@MMaynard](#):
>
> table = self columnData = table.columnAttributesData newData = system.dataset.setValue(columnData, 0, 'hidden', 1) table.columnAttributesData = newData

Thanks you for your reply Maynard.

I put this code in the initialize, and it did hide the first column on openning, but I don't have the choice of unchecking the hide check in my right click menu. I want to uncheck **id\_liste** in the image on openning the page.

```
table = self
columnData = table.columnAttributesData
newData = system.dataset.setValue(columnData, 0, 'hidden', 1)
table.columnAttributesData = newData

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/a/3abb493fe9350bc2db6c0644d5e88c1fb56f120f.png)

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 31, 2020, 2:10pm UTC](https://forum.inductiveautomation.com/t/ignition-vision-hide-a-colomn-from-script/40177/4 "2020-10-31T14:10:32Z")

</div>

Anything hidden by script has to be unhidden by script.  
Put the second part in the onPopupTriggered and it will have it in a popup script.
