# Select a Perspective Table Cell to Open a Parameterized Popup

**URL:** <https://forum.inductiveautomation.com/t/select-a-perspective-table-cell-to-open-a-parameterized-popup/82015>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [November 16, 2023, 9:21pm UTC](https://forum.inductiveautomation.com/t/select-a-perspective-table-cell-to-open-a-parameterized-popup/82015 "2023-11-16T21:21:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BQuacken](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@BQuacken](https://forum.inductiveautomation.com/u/BQuacken)\
**Post date:** [November 16, 2023, 9:21pm UTC](https://forum.inductiveautomation.com/t/select-a-perspective-table-cell-to-open-a-parameterized-popup/82015/1 "2023-11-16T21:21:38Z")

</div>

First, what I am trying to do is open a popup view and pass two parameters to it when a user selects a cell in a Perspective table (`enableRowSelection` and `enableColumnSelection` are both true). I have configured a Script Action in the `onSelectionChange` component event to accomplish this, and it works... mostly.

One of the parameters comes from the table's `props.selection.data[0]`, whose value I am getting on its own by adding `.values()[0]`; I am calling this the `piece`. The other parameter is a Custom property called `section` that looks for the `piece` in a different custom property (whose data is static) and returns a correlated string value.

The issue I'm having is that the `section` property being pulled into the `onSelectionChange` script action is delayed by one selection change. In other words, when I select a cell in a running session, the `piece` property populates with the newly selected cell value like it should, but the `section` property is populated with the value associated with the previous cell selection. For example, in a new page with the table, with nothing selected, when I select a cell for the first time, `piece` becomes `piece1` like it should, but `section` remains `null`, when it should be `section1`. When I select a new cell, `piece` becomes `piece2`, and `section` becomes `section1`, when it should be `section2`. This pattern continues with all additional selections.

I considered the possibility of `onSelectionChange` being the wrong event for triggering the action, but `onClick` won't even open a popup at all, and I am getting 1 of 2 properties like I expected, so I feel like the issue lies elsewhere.

Any guidance is appreciated.  
Thank you.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 16, 2023, 9:30pm UTC](https://forum.inductiveautomation.com/t/select-a-perspective-table-cell-to-open-a-parameterized-popup/82015/2 "2023-11-16T21:30:16Z")

</div>

You are expecting bindings to occur before events. The selection changes, then both the event **and** the dependent bindings execute, possibly in parallel. No defined order of operations, so it is not surprising that the dependent binding is "later" than the event.

Some possible approaches to consider:

- act upon a propertyChange on `sections` instead of the table selection. The downside is it might not be unique and therefore not fire when desired.

- Compute `section` within the selection event instead of using a separate binding. Then it is assured to be correct for the decisions within the event.

---

<div class="post-metadata">

**Author:** ![BQuacken](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@BQuacken](https://forum.inductiveautomation.com/u/BQuacken)\
**Post date:** [November 16, 2023, 9:48pm UTC](https://forum.inductiveautomation.com/t/select-a-perspective-table-cell-to-open-a-parameterized-popup/82015/3 "2023-11-16T21:48:03Z")

</div>

Thanks for the quick reply Phil! That makes a lot of sense.

I'll have to look into your first suggestion to see how that works for me. Option two looks like a surefire winner though.
