# \[IGN-3549\] Table selection is ignored during startup event

**URL:** <https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 19, 2021, 2:38pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092 "2021-07-19T14:38:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![SBL\_MC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sbl_mc/32/56813_2.png) [@SBL\_MC](https://forum.inductiveautomation.com/u/SBL_MC)\
**Post date:** [July 19, 2021, 2:38pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/1 "2021-07-19T14:38:52Z")

</div>

Hi,

We are running the nightly installed in the end of June (b2021062515). I have a project now where I want the top row to be selected as default when opening the view. I added a script to onStartup that loads selectedRow and selectedColoumn. Selection data is not updated until I click on a row. Is this the same bug?

self.props.selection.selectedRow = “0”  
self.selection.selectedColumn = “Voyage”

---

<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:** [July 19, 2021, 3:05pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/2 "2021-07-19T15:05:38Z")

</div>

That seems to be working for me in 8.1.7 which was before the nightly you supposedly have.

Please verify that your code is completing as expected:

```auto
# this line should supply a numeric value instead of a string
self.props.selection.selectedRow = 0
# This line should reference props
self.props.selection.selectedColumn = "Voyage"

```

---

<div class="post-metadata">

**Author:** ![SBL\_MC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sbl_mc/32/56813_2.png) [@SBL\_MC](https://forum.inductiveautomation.com/u/SBL_MC)\
**Post date:** [July 20, 2021, 6:45am UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/3 "2021-07-20T06:45:53Z")

</div>

on Event/onStartup on the table it self. I made labels linked to the used props and they return “null” until a row is selected.

 ![table](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/728905e800c3db9d818e1a4bb0f6a2f10bf5128b.jpeg)

---

<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:** [July 20, 2021, 3:01pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/4 "2021-07-20T15:01:52Z")

</div>

I’m using a 8.1.8 nightly build and the properties are working as expected there. We did do some work with the Table recently and I suspect it may have fixed the issue as you’re seeing it. The repaired issue revolved around the `selection.selectedRow` and `selection.data` properties not updating if the underlying `props.data` property changed, but I could absolutely see how this might have been resolved by the changes. What version are you using currently?

---

<div class="post-metadata">

**Author:** ![SBL\_MC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sbl_mc/32/56813_2.png) [@SBL\_MC](https://forum.inductiveautomation.com/u/SBL_MC)\
**Post date:** [July 22, 2021, 6:47am UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/5 "2021-07-22T06:47:58Z")

</div>

Im at b2021062515

---

<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:** [July 22, 2021, 2:10pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/6 "2021-07-22T14:10:49Z")

</div>

Oh! Is the Table driven by a binding? I’m betting you’re encountering an order of operations issue. I was able to replicate and I suspect it’s due to the fact that you’re setting a selection state for content which does not exist yet; the table is unable to reconcile the specified row/column combo because the binding has not resolved and so no rows or columns exist. Since the values supplied would be “invalid” the table ignores them.

I’m going to speak with a few people and see if there’s a better way to do this. I suspect some sort of onChange script coupled with a Boolean flag, but I’ll get back to you.

---

<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:** [July 22, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/7 "2021-07-22T14:43:04Z")

</div>

I moved this conversation to a separate thread because it is an unrelated issue and a separate internal ticket has been opened.

---

<div class="post-metadata">

**Author:** ![SBL\_MC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sbl_mc/32/56813_2.png) [@SBL\_MC](https://forum.inductiveautomation.com/u/SBL_MC)\
**Post date:** [July 23, 2021, 11:58am UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/8 "2021-07-23T11:58:54Z")

</div>

Yupp, its driven from a named query. I have been looking trough other events, but they will override a manual selection later on.

---

<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:** [July 23, 2021, 2:49pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/9 "2021-07-23T14:49:42Z")

</div>

You could try using [system.util.invokeAsynchronous](https://docs.inductiveautomation.com/display/DOC81/system.util.invokeAsynchronous) to sleep one second before forcing the selection. Your user in unlikely to make a selection within that second, but there is still a chance the selection would appear to not be in place and then would just appear.

---

<div class="post-metadata">

**Author:** ![SBL\_MC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sbl_mc/32/56813_2.png) [@SBL\_MC](https://forum.inductiveautomation.com/u/SBL_MC)\
**Post date:** [August 26, 2021, 1:38pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/10 "2021-08-26T13:38:28Z")

</div>

invokeAsynchronous: **Caution:** Under no circumstances should you ever do anything in the function that is invoked asynchronously that interacts with the GUI. This means things like window navigation, setting and getting component properties, showing error/message popups, etc

I added a binding on my components display prop. If selectedRow equals null, I hide it, and show a label “Please select a voyage from the list” instead. Rather this than showing overlays for a second.

A default selection value would be nice.

---

<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:** [August 26, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/11 "2021-08-26T14:43:32Z")

</div>

> [@SBL\_MC](#):
>
> invokeAsynchronous: **Caution:** Under no circumstances should you ever do anything in the function that is invoked asynchronously that interacts with the GUI. This means things like window navigation, setting and getting component properties, showing error/message popups, etc

That warning is for Vision, NOT Perspective. Note the broadly-scoped GUI term, instead of browser. I know it's a small distinction, but threads are handled differently in Vision than they are in Perspective, and so this is not a concern. If you're seeing overlays, then it's just a matter of the binding not having resolved. You could easily opt out of the overlay within the binding dialog.

---

<div class="post-metadata">

**Author:** ![Abhinandan\_Rb](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Abhinandan\_Rb](https://forum.inductiveautomation.com/u/Abhinandan_Rb)\
**Post date:** [January 9, 2023, 5:41am UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/12 "2023-01-09T05:41:54Z")

</div>

I added a 1 sec sleep command before the script and it works fine

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [January 9, 2023, 11:38am UTC](https://forum.inductiveautomation.com/t/ign-3549-table-selection-is-ignored-during-startup-event/49092/13 "2023-01-09T11:38:56Z")

</div>

Try with a change script on the `data` property instead.  
If you don't want the selection to be changed every time the table is updated, just add a custom property to hold a flag, and set it/check it when necessary.

edit: Actually I just tried and it doesn't work right off the bat.
