# Checkbox: it's not refreshing the init value if I sort the table based on the fact is it's checked or not

**URL:** <https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032>\
**Category:** Ask us anything\
**Created:** [December 19, 2024, 12:48pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032 "2024-12-19T12:48:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [December 19, 2024, 12:48pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/1 "2024-12-19T12:48:24Z")

</div>

So I have this dataset with one of the fields “is\_selected” and I have a sort on this field to have the checked at the top of the table, it’s a collection list btw.

Now when I check a random checkbox, it updates the “is\_selected” of the data in this row and this one goes to the top. Great.

BUT the row that I checked, stays checked. So the one that went to the top is also checked and the exact row that I checked is also checked, while the value of that row’s is\_selected = false.

How can I force the checkbox to check itself and it’s data to make sure it should be checked true or false…?

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [December 19, 2024, 12:58pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/2 "2024-12-19T12:58:07Z")

</div>

Also on deselecting, the one that I deselect jump to the bottom but on that specific row it stays uncheked (while that row’s data is now one with is\_selected=true).

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [December 19, 2024, 1:05pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/3 "2024-12-19T13:05:09Z")

</div>

As you can see in the screenshot, the “is\_selected” value for exactly this row is false but the “preview” shows the checkbox checked. So to rephrase the question; how to let the checkbox check if it has the right value?

 ![Screenshot 2024-12-19 at 15.03.55](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/0a90a3ed70a285862f0ac4d2521453c9132721f5.png)  
 ![Screenshot 2024-12-19 at 15.03.59](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/413688d85db371eb67a569b331fed9b017787092.png)

---

<div class="post-metadata">

**Author:** ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)\
**Post date:** [December 19, 2024, 3:48pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/4 "2024-12-19T15:48:24Z")

</div>

Hello @alexanderl,

It’s a limitation of WeWeb, you are in a repeat item and we have no way to identify each item, we are using the index on our side.

In the item that is repeated, you can go to the setting tab. Add a new attribute. You can name it `key` and bind the value to a unique key of your data

 ![Screenshot 2024-12-19 at 16.46.12](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e0d94ba3284e48088805adf4389bcf4f06327417.png)

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [December 19, 2024, 4:59pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/5 "2024-12-19T16:59:11Z")

</div>

Ah that makes sense. Thanks will give it a go!

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [December 19, 2024, 7:59pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/6 "2024-12-19T19:59:18Z")

</div>

Hey @Mael , I’m sorry but it didn’t work. I gave the flexbox with the checkbox an attribute id and set it to a unique value of that row. Also tried with the checkbox itself giving it an attribute id. Same thing. Any tips?

---

<div class="post-metadata">

**Author:** ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)\
**Post date:** [December 19, 2024, 9:21pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/7 "2024-12-19T21:21:47Z")

</div>

Could you please share a screenshot of what you did? If you could send the layout in the screenshot, it will be perfect to help you

---

<div class="post-metadata">

**Author:** ![dsturnerville](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dsturnerville/32/7628_2.png) [@dsturnerville](https://community.weweb.io/u/dsturnerville)\
**Post date:** [January 30, 2025, 8:26pm UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/8 "2025-01-30T20:26:36Z")

</div>

Were you able to resolve this? We are having a very similar issue.

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [February 26, 2025, 9:01am UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/9 "2025-02-26T09:01:07Z")

</div>

I was not able to resolve this. But looking at it again now. @Mael can you explain maybe which element exactly needs the ID? I tried adding the ID to the entire row, but also to just the checkbox or the flexbox around the checkbox. But no success just yet.

So starting with nothing selected:

 ![Screenshot 2025-02-26 at 10.58.05](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/8176ed38e800a05fae0a3216d2b3ec8e6a6fd357.png)

Then clicking Career Bridge, will bring Career Bridge to the top, but also keep the checkbox I just clicked, selected at the same row. So now we have 2 checkboxes selected. The bottom one should not be selected as I just wanted Career Bridge to be selected.

 ![Screenshot 2025-02-26 at 10.58.16](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/961a96edcda32caa36e95d496cd5f1224e735c5b.png)

Here’s the setup for the row/checkbox or flexbox, all tried seperately and also combined:

 ![Screenshot 2025-02-26 at 10.58.56](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b61534c0e73145731612d87dbb8f38b3ecbe7c83.png)

---

<div class="post-metadata">

**Author:** ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)\
**Post date:** [February 26, 2025, 9:16am UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/10 "2025-02-26T09:16:11Z")

</div>

Hello @alexanderl,

You need to set it for the entire row. But that’s my bad, I will update the previous answer I sent, could you try to set the `key` as id

---

<div class="post-metadata">

**Author:** ![alexanderl](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexanderl/32/9235_2.png) [@alexanderl](https://community.weweb.io/u/alexanderl)\
**Post date:** [February 26, 2025, 9:27am UTC](https://community.weweb.io/t/checkbox-its-not-refreshing-the-init-value-if-i-sort-the-table-based-on-the-fact-is-its-checked-or-not/15032/11 "2025-02-26T09:27:40Z")

</div>

Cool, that worked!
