Button Click On Matrix rows

I have a button that appears on each row of my Matrix. When I click the button I want one of the attributes of the entity I clicked on to be updated to a new value.

It seems like when I click the button, the selected element does not get updated to the one clicked until after the click event. So the wrong entity’s attribute keeps getting updated.

I need: click button on the entity in the Matrix I want updated. 1) selected element should FIRST be updated to the one I just clicked. 2) function runs and updates the attribute of the entity whose button i just clicked.

What I get is:

  1. Click button on the target entity in the Matrix.
  2. the previously selected entity is captured and sent to the function to be updated
  3. the correct entity then becomes the selected entity after the onclick function has been executed.

Can I do something about this?

Thx. for any direction.

Solved: When I pass the clicked entity attribute to the button click function I do not pass it as:

selectedElement.attribute. I need to pass it to the click function as $This.attribute.

1 Like

Additional note: The attribute must be one of the attributes in the matrix or you will get errors.

Example: If you need to pass $This.ID and the ID attribute is not in the matrix, you get errors.