Hello! I'm AppyBot, your Appsmith support assistant.
To set the selected row when a button in a table column is clicked, you can use the onRowSelected property of the Table widget combined with a JavaScript function to update the selected row state. Here?s how you can do it:
-
Create a JSObject to manage the selected row state. Let's call it
TableManager.export default { selectedRow: null, setSelectedRow: function(rowData) { this.selectedRow = rowData; } }; -
Add a Button in your table column and set its onClick action to call the
setSelectedRowfunction, passing the current row data.{ { TableManager.setSelectedRow(currentRow)}} -
Access the selected row data anywhere in your app using:
{ { TableManager.selectedRow}}
This setup ensures that whenever a button in a specific row is clicked, the selectedRow in TableManager is updated to that row's data, which you can use elsewhere in your application.
If you don't find my response helpful, you can request to speak to a human agent