Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Update table post API query?

Issue

I am having trouble updating a table with filtered results using an Input widget and Button widget. Although the filtering works and is displayed correctly in console.log(), the table never updates with the new rows. I tried using {{Data.GetCompanyList.data}} for the table data, but it did not work. Eventually, I realized that I needed to call the query directly in onSearchTextChanged and use {{DataApi.GetCompanyQueryMapped(apiQuery.data)}} for Table Data.

Resolution

The problem was that the customerTable was not updating with filtered results from Data.GetCompanyList, even though console.log() was showing the correct filtered data. The solution was to call the query directly in onSearchTextChanged and then use DataApi.GetCompanyQueryMapped to map the API response. Table Data was updated to {{DataApi.GetCompanyQueryMapped(apiQuery.data)}}. onSearchTextChanged was updated to {{
apiQuery.run({
entityName: DataApi.GetCompanyQueryEntity(),
filters: DataApi.GetCompanyFilters({
nameContains: companyTable.searchText
}),
})
}}. This allowed the table to update with the filtered results. Great work by the user in figuring this out and documenting the solution for others.