How do I connect two widgets with a JS object?

I have a MultiTreeSelect to choose value A from and a Table to show rows based on value A

I have some DynamoDB table queries I map together to my custom array.

The onOptionChange event on the MultiTreeSelect is set to trigger a JSobject function that pulls together new data, and I have verified that the data returned from the function is correct.

However, I can not find out how I can get the table to refresh its data when the selected value of the Select changes.

If I use the function result ( as Table Data in design mode, select a value in the Select and run my function manually the Table will update. When I change the Select value the table will not update.

If I add an array property to the JSobject and populate that array and use it in the table, the result is alwys blank.

Hello Oskar and welcome to our community! :wave:

The issue you described is happening due to this bug: [Bug]-[5196]:JSObject Async function response data is not set when the function is executed using widget event like button onClick · Issue #15056 · appsmithorg/appsmith · GitHub
The workaround for it is to use storeValue() in your JS function and consume the value in the Table Data property of the Table widget.

Thank you.

If I understand this correct;

instead of returing data from the getTableData function I can store it by doing await storeValue("tableData", myArrayWithTableData), bind the table to it with by using {{ }} for the Table Data property and then the table widget should automatically update when I run getTableData from another widget?

Yes, that’s correct. Please let us know if it works or if you face further issues.

Yes, that worked. Thank you!