# Create button through script?

**URL:** <https://forum.inductiveautomation.com/t/create-button-through-script/45410>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [April 8, 2021, 6:59pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410 "2021-04-08T18:59:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 8, 2021, 6:59pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/1 "2021-04-08T18:59:00Z")

</div>

Is there a way to create a button component through scripting? What I would like to do is use a table to display data using the Rosters and I want to add a remove button next to each user in the Roster.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [April 8, 2021, 7:12pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/2 "2021-04-08T19:12:56Z")

</div>

You can put an embedded view in a cell in the table. This can have buttons or really anything you want.  
See manual pages: [Perspective - Table - Ignition User Manual 8.0 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC80/Perspective+-+Table)

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 8, 2021, 7:17pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/3 "2021-04-08T19:17:55Z")

</div>

That really isn’t the same thing as it would require the user to click on the arrow next to each record to display the choices, so they are hidden by default. What I would like to do is display a “Remove” button on each row next to the user.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [April 8, 2021, 7:45pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/4 "2021-04-08T19:45:43Z")

</div>

> [@tony.petruzzi1](#):
>
> click on the arrow next to each record to display the choices

I'm not sure I understand what this means. As a quick proof of concept I put this together, which I think does what you're looking for.

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

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [April 8, 2021, 7:47pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/5 "2021-04-08T19:47:51Z")

</div>

zacht answer seems to do what you want

I did this with Icons instead of button

1. Define a view with possible action, with a params called value
2. Define a column in your table with a render view, and set the viewPath. (whatever field you define will be sent as params.value in your action view, so an Id is probably a good choice)
3. In your action event do whatever you see fit.

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 8, 2021, 9:25pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/6 "2021-04-08T21:25:21Z")

</div>

How did you manage to do that?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 8, 2021, 9:27pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/7 "2021-04-08T21:27:04Z")

</div>

You have to set the render mode of the column to “view”, and then supply a valid path to a View. The View you provide the path of should contain just the button. The View used in the cell will receive the value of the column it is rendered in as part of a `value` param.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [April 8, 2021, 11:09pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/8 "2021-04-08T23:09:34Z")

</div>

Pretty much what @cmallonee said. I set the `viewPath`, left the column `render` mode at “auto” and everything worked, but I’m running 8.0.10 which is getting a little old at this point. My view is has a flex root container and the button has a position basis of 100%. I’m sure there are other (maybe better) ways to arrange the details, but this worked for me.

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 9, 2021, 2:44pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/9 "2021-04-09T14:44:54Z")

</div>

i have to try this 😲

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 9, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/10 "2021-04-09T14:45:31Z")

</div>

Alright… i’m playing around with this now… thank you both

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 9, 2021, 2:58pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/11 "2021-04-09T14:58:06Z")

</div>

Question… Is there documentation or something in the IU that covers this? As dumb as it is… I’m having a hard time just renaming the column name, right now it’s called column\_3 and I don’t see where to rename it.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [April 9, 2021, 4:07pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/12 "2021-04-09T16:07:05Z")

</div>

In the table properties, `columns -> 0 -> header -> title` will change the column display name. I don’t think that changes the name in the underlying data though.

---

<div class="post-metadata">

**Author:** ![tony.petruzzi1](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tony.petruzzi1](https://forum.inductiveautomation.com/u/tony.petruzzi1)\
**Post date:** [April 9, 2021, 5:41pm UTC](https://forum.inductiveautomation.com/t/create-button-through-script/45410/13 "2021-04-09T17:41:55Z")

</div>

thank you
