docs/versioned_docs/version-3.0.0-LTS/widgets/table/serverside-operations/search.md
This guide explains how to perform a server side search operation on the Table component in ToolJet.
<div style={{paddingTop:'24px'}}>Before performing the search operation, add the Table component and populate it with data:
SELECT * FROM public.sample_data_orders
LIMIT 100
{{queries.<query_name>.data}} to populate the Table component with the data retrieved by the query.Follow the mentioned steps to perform server side search operation on the Table component:
Enable Server side Search under the Table component properties.
Enter the following query
SELECT * FROM public.sample_data_orders
WHERE city ILIKE '%{{components.table1.searchText}}%' OR
country ILIKE '%{{components.table1.searchText}}%' OR
state ILIKE '%{{components.table1.searchText}}%'
LIMIT 100
The above query searches for the searched text in the city, state and country columns on the server side and returns the data. Note: Make sure to replace table1 with your Table component name.
Add an Event Handler to the Table component:
Event: Search
Action: Run Query
Query: Select Your Query
This will run the query and fetch the data every time something is searched.
{{queries.getOrders.isLoading}} in the field to add a Loading State. Note: Make sure to replace getOrders with your query name.This is how server side search operation is implemented in ToolJet's Table component. Now when a search is performed in the Table component, the query is executed on the server, allowing the search to be applied across the entire dataset.
</div>