Category: JavaScript
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Is it possible to disable the selected row on button click?

Issue

I want to be able to disable/enable a particular row in a table on a button click. I can use the storeValue function to store the selected row index and then bind it to the Default Selected Row of the table to disable/enable it. Alternatively, I can use resetWidget function to remove any selected rows. However, I cannot edit row values, only perform actions on columns with buttons or icons.

Resolution

To disable or enable a particular row in a table on a button click in Appsmith, you can use the storeValue function to store a value that indicates whether the row should be disabled or not. Bind the value of the store variable in the Disabled Property of the column to disable or enable the row.

You can update the value of the storeVariable to the selected row index on row selection or button click. Alternatively, you can use the resetWidget(“TableName”) function to remove any selected rows.

Unfortunately, Appsmith does not allow you to directly edit row values, only perform actions on columns with buttons, icon buttons, and other widgets. However, you can still use the storeValue function to achieve the desired result. The sample app linked provides a good example of using the storeValue function to control the behavior of a widget based on user interactions.