How do I configure the actions to ONLY affect the selected row?

When I click on the action buttons, all rows become editable. How can I make only the action buttons affect the selected row?

gif

Hi @mander :wave:

Did you build your own data grid ?

If so, can you share more information, maybe record a short video to walk us through how you built it so we can see what’s going on?

If you’re using the data grid element from the WeWeb UI kit, it should work like this out of the box:

CleanShot 2023-09-08 at 16.57.26

So you might want to drag and drop the element on the page and compare the default settings with the settings of the data grid you’re working with.

Sure. I am not using the ready made datagrid element.
I used the table element to build my own datagrid.

I have an array of data (objects) with a bind to the table collection list.


I cannot copy and paste the “Line” item in the Navigator when a collection is binded.

I’ve been dealing with this on a project actually. Same situation, same setup. What you got to do is:

  1. Create an Array Variable where you’ll be storing the state

  1. On click setup the following workflow

2a. Update one item → Index to item.index

2b. Value to the following

  1. Then you just bind your state to the following

  1. If you want to cancel the opened (true) state, you just use exactly the same workflow that is explained in the step 2.

Explaination

This works on the premises that in an empty Array, until created an item at any index, calling the index returns undefined which in javascript has the same effect as false, once you trigger the workflow number 2, you basically set the item at the index of the empty array to the opposite of false, which results to true, or opened/active. When you repeat this, you just negate it, turning the value at the index to the opposite which in this case means false. With this approach, you can have infinite amount of items, and store their states in a very slick way in my opinion.

Screenshot 2023-09-09 at 00.32.48

If you have any questions, feel free to ask

2 Likes

Glad to see I’m not the only one experiencing this. Will try your method and report back. Thanks!

It’s not a bug, it’s a feature haha. As for the method, it should work, it’s just a little harder to understand. Make sure you follow it step by step

Had to play around with the conditions since I was applying the change to the read only state, but got it to work nicely!

Thanks again for the help @Broberto

vid

2 Likes

@Broberto curious if you also experienced the following:

I’m trying to update my backend with the value of the input. However, the value of the input is not to be found anywhere in my variables.

The input element is not showing up as a variable in “FROM COMPONENTS IN CURRENT PAGE” when it is nested within the table.

However, it shows up when the input is OUTSIDE of the table.


When inputs are in a collection list or another repeated layout you need to keep track of the values using onchange workflow. You can read how to do it here

1 Like

I was just about to link to this @dorilama’s post, you’ll find all you need there.

2 Likes