Hi, I'm new to retool and I'm trying to create a table that can switch what data source and columns that it's displaying through the use of java script.
For example, I have two buttons - user and employer - that with JavaScript trigger two different queries to Select information from my database. Each query is fetching that data from different database relations userRelation and employeeRelation.
I want to have a single table that can display both sets of output at different times.
Essentially what I want to do is, when I press the user button:
userquery.trigger()
table1 datasource = userquery
table 1 reset columns
The table displays the output of user query with correct columns
and when I press the employer button:
employerquery.trigger()
table1 datasource = employerquery
table 1 reset columns
The table displays the output of employer query with correct columns
What would be the best way to go about making something like this?
Thank you.