I have an app with a table and a form based upon a query. The data in the form is queried based upon a related id in a field in the selected table row. When I initially create the form all of the components update properly when I change the selected row in the table. However, when I modify the field, for example, to change it from a textArea to a textInput it seems to break the association between the form and the component. Other modifications also cause it to break as well. Once broken, the component never updates when a different row is selected in the table (and thus a different id is used for the form's query). When I look at the form's state, I can see it has the component shown in the "Depends on" list, but not in the "Updates" list. It was shown in the "Updates" until I modified the component. I find the same break in the association occurs when I modify a select component to use Mapped values. Initially it is in the Updates, but the moment I click on the Mapped tab and set the Data Source to a query it drops from the "Updates" list. Is this a bug? What is the workaround? Can I repair the list of components that the form "Updates"?
I've been working quite a bit with tables and forms and haven't come across anything like this. I also haven't been paying enough attention to notice "Controls, Updates and Depends on" panel - new to me.
If I add a select component to an existing form is see Updates populate with the select components name. If I remove the form data key of the new select, the select component is removed from Updates.
I do have to refresh or navigate away from State to get "Controls, Updates and Depends on" to update.
Your form data keys match the data source object's properties?
What happens if after you remove the form data key and then add it back in again or change it another field name?
My form data keys are correct for the data source.
When I clear it out it is dropped from the form's update list. If I add it back in to the component's Form Data Key the component reappears in the update list and it refreshes properly when you select a row in the table. This makes sense. Not sure why other modifications don't cause it to drop or not reappear in this list.
I'm not sure I'm following.
When you hover over the component in each list it lists reason(s) why it's listed.
I just now started with a 100% new app so there would be no legacy issues. I created my queries, table and form. I tied my form to the table based upon a foreign key for the related db table. I then added two components from the related table, "Building_Location" and "Building_Zoning_id" the latter of which is a foreign key into a third table which has the various zone values and names. The Building_Location component I added is a select type. The form's state shows the "select1" component in both the "Updates" list and the "Depends on" list.
At this point both components update correctly as I click from row to row in the table component. Next, I change the select component's Options to Mapped and point this to the query on the table of the zone values and names. Now when I refresh the state for the form component, the "select1" component has disappeared from the "Updates" list, however it is still shown in the "Depends on" list. And now this component does not refresh when I click from row to row in the table.
I can reproduce that, but when I refresh the page it works properly. I'm sure you've done that, correct?
Shot in the dark to consider is auto-mapping... are you using table1.selectedRow
or table1.selectedSourceRow
?
table1.selectedRow
returns the mapped values in the table and auto-mapping does stuff like
in my example it returns
{
"id": 0,
"name": "abc",
"type": "Mfg"
}
If the select mapping is based on the source like "type":"mfg"
, then it doesn't match and select doesn't populate.
Using table1.selectedSourceRow
provides the raw data of the selected row.
{
"id": 0,
"name": "abc",
"type": "mfg"
}
You are correct that simply refreshing the page does fix the missing "Updates" list. The app then does appear to refresh the formerly missing component (the load glyph runs when selected rows in the table component).
It seems that retool likes to have the page refreshed frequently to make sure everything is updated properly. Just be sure to make sure you have any query changes saved before you do so!