# Datagrid: capturing selected rows after checkbox?

**URL:** <https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239>\
**Category:** Ask us anything\
**Created:** [June 28, 2023, 1:36am UTC](https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239 "2023-06-28T01:36:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sleeusis](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sleeusis](https://community.weweb.io/u/sleeusis)\
**Post date:** [June 28, 2023, 1:36am UTC](https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239/1 "2023-06-28T01:36:12Z")

</div>

Hello everyone, I’m new to weweb but I already in love with the platform. Related the Datagrid, how would I capture the changes of when a row is selected via the checkbox? I tried the onclick event but the component’s selectedRow yields the states prior the click on the checkbox but not after the click.  
Thank you

---

<div class="post-metadata">

**Author:** ![sleeusis](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sleeusis](https://community.weweb.io/u/sleeusis)\
**Post date:** [June 28, 2023, 2:50am UTC](https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239/2 "2023-06-28T02:50:24Z")

</div>

Just I follow up, I think I figured out. The onClick if done at the checkbox level will get the value from selected row prior the check and the onClick at the datagrid level then will give you the value after the click.

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [June 28, 2023, 11:53am UTC](https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239/3 "2023-06-28T11:53:37Z")

</div>

Hi @sleeusis 👋

The Datagrid comes with a `selectedRows` component variable which is updated automatically when you select an item in the Datagrid:

 ![CleanShot 2023-06-28 at 13.52.19@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/48de65f47a47b5ca60863d13e4ac697aa61474b9.png)

---

<div class="post-metadata">

**Author:** ![aeynaud](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aeynaud/32/2050_2.png) [@aeynaud](https://community.weweb.io/u/aeynaud)\
**Post date:** [July 29, 2025, 4:45am UTC](https://community.weweb.io/t/datagrid-capturing-selected-rows-after-checkbox/3239/4 "2025-07-29T04:45:00Z")

</div>

Hi @Joyce ,

Just wanted to check. Workflows with actions “Reset Variable Value” or similar do not have these component variables exposed to be interacted with.

Do you know how I can programmatically unselect the rows?

In this case I am not sure if `wwLib.getFrontDocument("my-datagrid")` would tell me much because you are having a separate “DataGrid - selectedRows” variable stored e.g., `variables["ajhdhd0d-ehfefehjf etc.."]`.

I can find the id by turning a “Return a value” workflow action from Formula to Javascript:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/223b197cccd1fcb488ee425450a97f6d2b9c0801.png)

But is this value static or re-generated each time on page load?

Many thanks in advance,  
Adrien
