# Multiselect rows in a Table from a script

**URL:** <https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 25, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973 "2023-10-25T17:02:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/1 "2023-10-25T17:02:25Z")

</div>

How to do? I tried copying `props.data` to `props.selection.data` (sic) but no go.

---

<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:** [October 25, 2023, 5:51pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/2 "2023-10-25T17:51:51Z")

</div>

`props.selection.data` is, as far as I know, read only. It's only there to reflect what data is selected, it doesn't dictate what is selected.  
I'm not sure what you can do. Maybe `selection.selectedRow` is where it's at ?

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/3 "2023-10-25T18:00:26Z")

</div>

It looks like it holds one value, so what should I put there?

---

<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:** [October 25, 2023, 6:01pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/4 "2023-10-25T18:01:41Z")

</div>

Even when multiple rows are selected ? That's surprising, I would expect it to switch to array when multiple selection is enabled.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/5 "2023-10-25T18:08:50Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/8/68a0f56bbb279c464437245331918079c87fdfcd.png)

Here you can see that I have 3 rows selected in the bottom table (using `Shift` + click) and that the `selectedRow` and `selectedColumn` props only have one value 😢

---

<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:** [October 25, 2023, 6:19pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/6 "2023-10-25T18:19:03Z")

</div>

Indeed, the doc says it's the index of the first selected row. I have no idea how you could, if possible, script the selection of multiple rows...

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 25, 2023, 6:19pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/7 "2023-10-25T18:19:54Z")

</div>

No problem here on 8.1.31.

 ![Table selection data](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/6/560149030d797cd67642fa5d0aca67074bb5c0d9.png)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 6:23pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/8 "2023-10-25T18:23:20Z")

</div>

You wrote to `props.selection.data` and it showed up as selected in the table?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 25, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/9 "2023-10-25T18:28:02Z")

</div>

> [@YF129701](#):
>
> You wrote to `props.selection.data`

No, I'm addressing your post #5. You have multiple rows selected and they're not showing up in `props.selection.data`.

There was a post a while back explaining why programmatically selecting rows would be problematic. I'll see if I can find it.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 6:41pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/10 "2023-10-25T18:41:49Z")

</div>

Ok see if you can find it... They are appearing in `props.selection.data`, I was referring to the fact that a single integer appears in the `selectedRow` property, if you look closely, there are 3 fields in `props.selection.data`.

I will probably just use an embedded view with a checkbox to do multiselect and style the rows based on the checkbox value. I wish there was a native way to do a "Select All" action.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 25, 2023, 7:22pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/11 "2023-10-25T19:22:01Z")

</div>

> [@YF129701](#):
>
> I will probably just use an embedded view with a checkbox to do multiselect and style the rows based on the checkbox value. I wish there was a native way to do a "Select All" action.

This is what I ended up doing for a project I'm working on. I also added a way to multi-select rows on a display without a keyboard by being able to click a row and then another row and the rows inbetween and inclusive would be checked. It worked out pretty well.

~~You have to add the row number to your dataset which is so-so.. otherwise the checkbox won't be able to know what to check in your table. It's very awkward as you can't just turn on the checkbox, even if it's bi-dir bound to the incoming data from the table; the checkbox turns on but the table data doesn't change.~~ You have to use messaging to change the value in your table dataset.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 25, 2023, 7:28pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/12 "2023-10-25T19:28:05Z")

</div>

You don't actually need to pass in the row value, it is passed automatically into a table column's subview. See [here](https://forum.inductiveautomation.com/t/documentation-on-what-is-passed-to-table-cell-rendered-as-view/53951)

This is probably what I'll do..

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 25, 2023, 7:29pm UTC](https://forum.inductiveautomation.com/t/multiselect-rows-in-a-table-from-a-script/80973/13 "2023-10-25T19:29:48Z")

</div>

Ohhh, that's much nicer! Cheers
