Hello, I would like to update the selected values from a changeset back to the table. I am using a JS query to transform the data, and I would like to update the values which are currently selected as well. When I click the save button on the table I have created a new JS query which presumably would update the table selected values.
However, I don't see the API which would allow me to set a selected value for every row in the changeset. How do I do it? How do I achieve it?
As far as I understood there is a big proclivity to not update the table from the JS on the frontend directly but use the query/datasource to refetch the data from the data source.
This is not something I need, nor want to do.
I am fetching the Git Tag revisions from Github directly, hence no updates are warranted. Changing the values/updated values are not being set in the table once selected. (I am using the save Handler and also Cell Handler, frankly, no idea if I should use one or the other as both should be captured by the table).
How do I force the update of the table without the unnecessary fetch of the same data from Github?
I am not sure I fully understand the goal of the operation. You have a table which shows your repositories and version tag information. What is the data source for releasesTable? When you chose the From and To tags, that options list is sourced directly from GitHub?
What do you mean by this? You need to edit every row in the changesetArray and modify the values? What values are being modified and why?
The save handler should be writing the information to the source of releasesTable. What is being fetched from Github during the update process?
What is being fetched from Github during the update process?
Nothing. I am not going to update GitHub at all. I want to process the updated table.
The idea is to fetch the released versions from a variety of github repositories, fetch extra information and compile that into a text output. I am generating the release notes, so nothing is being updated at GitHub.
I asked because you mentioned you are trying to do this without unnecessary fetches from GitHub.
The from property value mapping shouldn't be tied to a selectedRow, that will always show the version of the actively selected row. Since you have the response formatted with "name", "from", and "to" properties your JS code should just be assigning the proper value to the property for that repository and you should probably use the default table mapping source of "from" and "to" for those columns.
If the repository information in the table is not being changed by a user and is just reporting the results of the GQL being parsed, it doesn't seem like you need to make edits to the table at all. Is that correct?
So it seems like the save event of the table is more to trigger the operations that generate release notes based on a user selection, then?
If this is the case, I strongly suggest not using a table for user input selections.
A better fit would probably be a List View that has components for users to select the repos/versions that are required for their output and then triggers operations from a final confirmation button/submission.
Most of the data you are already querying can be used for the List View just as easily without trying to work around a way to make the table component behave outside of its intended use.
The main use of a table is to display data. Tables, in Retool especially, are connections to data that you need to review and possibly change. Their function is mostly built around handling some basic CRUD activities (which is why the Save Event handler generally triggers and update operation to the underlying data).
If I understand your process correctly, you are querying your GitHub resource to get all of your repositories and their version information (current and historical).
Your users are going to be presented with all of the repositories and the options to choose versions (from/to) to generate a set of release notes pertaining to their selections.
The table you are using displays the data, but you need to allow users to "change" the values of the from and to columns and have that data used so that the proper release note information can be generated as a text output.
Where are you saving these changes? What triggers the output?
To fully use the table in the way you are attempting you would need to likely store the original table data into a separate state that is used to display the table, write all of the changes made to the table to this state/variable, and then refresh the table with the updated state. At the end of all of those choices/saves you would process the final state for your outputs.
A List View would take all of the original query data and add in components like list box selections to choose versions for each repository and run the outputs when a button is clicked by the user.
Neither way is more or less "appropriate" but, again, the table isn't really a vehicle for user interaction beyond CRUD operations and there are many other components that are more user (and developer) friendly and have more straightforward implementations.
Based on what you've explained, in my humble opinion, a List View is a better component choice than a table to achieve your desired goals.
I am not saving them currently anywhere. There is a second big button that should fetch all the necessary information from GH again given the information in the table ("the current state").
This is kind of the heart of my point. You aren't trying to actually save any data on the table, just use inputs that are in the changesetArray to do something. To me, it seems like this is working against the intended use of the table component.
List View:
Show all repos, with components for From/To selections and a big "get release info" button.
When the List View item's button is clicked it triggers the GH resource to get you the info for that item's values (would be analogous to a table row's columns).
You can also put validation on the selections so it only runs when all of the required selections are made.
The more I hear about it, the more I am sure that a List View is a better choice.
Right, i have successfully mapped the model to the list view with a few selects.
Now I don't know where to get the values for these selects from. The documentation says that these selects are only accessible from within the view, which is very awkward.
As I consider your use case more, if your end goal is to use the selections so users can get each repository's releases you should be fine with the list view. If you need to have an overall "get all the selections at once" process flow then you may need to use a different approach to get all of the user inputs collected (maybe a form entry submission page or modal?)
Here is an example of the list view reporting the selected dropdown values that shouldn't be hard to extrapolate from. The List View is using the data source's primary key as its own and then the select components are tied to the "item" where the click is happening:
As a POC it should help to get you started on using List View component data on an item by item basis.
Quick follow-up: As I said before, using a table isn't wrong, it just seems a bit clunkier (to me) to process the changesetArray for your calls, but it would work!
The table's save event handler would run through the changesetArray to process the changed columns and send a trigger to the query that would process/deliver the release notes (likely using additionalScope). Afterwards, you can leave the changesetArray alone (so users would still see the Cancel/Save UI element) and the values would stay "edited" or you can clear the changesetArray after the last query to revert to the original table data.
hey thank you for your help. I think I will take a break over the weekend sit on it and redo the UI again on Sunday, I guess.
If you know of a dynamic container that fulfils my needs without some arbitrary restriction let me know. I spent heaps of time on this and my other work is getting stalled.
Using these, you can trigger the necessary operations from an outside button and get the release notes data back and/or transform it how you need for the next step in your process.
In the JS you could build in logic to ignore selections that are null or you could disable the triggered query when the additional scope values are null. I think the List View is still the right container for the job, but using Retool has its quirks and caveats.