How to access datasheets from javascript functions


#1

I am working on a dashboard product that needs to display data from several different tables. I have already setup the JSON import plugs-in that can read the tables from AWS into the DataSheets. Now I need to collect the information from the tables and display it.
For example, I have a list of objects that need to have their status displayed. That information is spread across DataSheets A, B and C. Is there a way for a script to directly access the DataSheets from JavaScript?
In the sample code for the Transformer function, there is an interesting line for accessing Data Slots:
exampleValue=this.props.appActions.dataSlots['ds_Example'];
Is there are similar function to read a datasheet?
Is there are function to write to a datasheet?
Thank you in advance!
-K


How to write a new document of a Firebase Collection taking the given userId key(UID)
#2

Yes, definitely!

You can write it similar to the Data Slots code:

this.props.appActions.dataSheets[‘Sheet 1’]

Or use the following methods (implemented in exported project’s App.js file):

this.props.appActions.getDataSheet(sheetId)
this.props.appActions.addToDataSheet(sheetId, newRow)
this.props.appActions.updateInDataSheet(sheetId, row)
this.props.appActions.removeFromDataSheet(sheetId, row)

-Juha


#3

There is a scripting option for List/Grid element In the latest React Studio version. Maybe you could use that as well for creating the list based on several Data sheets.

Anyway if possible I’d suggest to have this logic implemented in the API so that you’d only need to load the data to one Data sheet rather than having to create scripts all over the place.


#4

Thank you for the response. I did indeed move all the multi-table (“Join”) logic in an AWS lambda call (in Python!). So now I have a single API call that returns all the dashboard data in a single HTTP GET statement.


#5

Hi Antti,
Thanks. I tried the Grid but it references a single fixed-size component, making the entire table a collection of cells, all with the exact same size. I have not found a way to allow the referenced-component to vary in size.
Please let me know if I am wrong about that.
As a result, I’m having to build a React-Component plugin.
-K


#6

The width of the List/Grid is always same but the height of the component can vary based on the component state or content. Is it the width that you want to change between columns?


#7

Yes. I would like the width to vary, as in a table that is responsive.