# Perspective Table Subview Script Control

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [May 3, 2022, 5:40pm UTC](https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170 "2022-05-03T17:40:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcaudle](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jcaudle](https://forum.inductiveautomation.com/u/jcaudle)\
**Post date:** [May 3, 2022, 5:40pm UTC](https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170/1 "2022-05-03T17:40:21Z")

</div>

Is there a way to control a perspective table’s subview through scripts? Toggle Expand and Collapse? I already scripted a ‘select the expanded row’ but that is only half the problem.

If I expand a subview, passing that rows parameters, then change the selected row the parameters update but the subview doesn’t change to the new selected record. Can one collapse the previous subview and expand the selected row’s subview?

It makes no sense to have this feature drilling into a rows data if the subview doesn’t match the selected record.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 3, 2022, 6:13pm UTC](https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170/2 "2022-05-03T18:13:35Z")

</div>

In 8.1.17 (see [release notes](https://inductiveautomation.com/downloads/releasenotes/8.1.17-rc1)):

> The Table component now has two scripting functions: expandSubviews and collapseSubviews. ExpandSubviews takes in an array of indices of rows to expand (will only expand rows that are currently visibly displayed on the table) and collapseSubviews takes in either an array of indices of rows to collapse (will only collapse rows that are currently visibly displayed) OR no parameter at all to collapse all currently expanded subviews that are part of the current visible data

---

<div class="post-metadata">

**Author:** ![antonio\_graham](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@antonio\_graham](https://forum.inductiveautomation.com/u/antonio_graham)\
**Post date:** [June 21, 2023, 4:12pm UTC](https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170/3 "2023-06-21T16:12:42Z")

</div>

Has anyone solved this ?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 21, 2023, 4:14pm UTC](https://forum.inductiveautomation.com/t/perspective-table-subview-script-control/59170/4 "2023-06-21T16:14:34Z")

</div>

Ummm...There is literally a solution marked.

If you're not running 8.1.17 or newer, it would seem you either need to upgrade or there is no viable workaround.
