Setup Server-side Search on Table
This page shows you how to set up server-side searching on the Table widget, which allows you to search the entire database without relying on the client-side.
If you are using the one-click binding feature to connect data, Appsmith automatically generates a server-side searching query for you. However, if you prefer to manually configure the server-side setup, you can do so by following the instructions in this guide.
Prerequisites
A Table widget connected to a query.
Configure query
Most databases and APIs support server-side searching, although the methods of implementation can vary.
Configure the query to fetch data using the searchText reference property.
Example: if you want to search data based on user names:
- For PostgreSQL, you can configure the query as follows:
SELECT * FROM users WHERE name LIKE '%{{Table1.searchText}}%' ORDER BY id LIMIT 10;
This SQL query fetches rows from the users
table where the name
column partially matches the searchText
input.
Ensure that you turn off prepared statements in the query editor for this configuration. For more details, see Prepared Statements.
- For the REST API, configure the query parameter as shown in the URL:
https://mock-api.appsmith.com/users?name={{Table1.searchText}}
Configure Table widget
Follow these steps to configure the Table widget to display fetched data, and implement server-side searching:
Connect the query to the Table data.
Enable the Allow searching property.
Set the onSearchTextChanged event to run the query.
After completing these steps, you can search for specific terms using the Table widget's search box.