Reading query params from URL
Last updated
Was this helpful?
Last updated
Was this helpful?
This navigation use case focuses on how you can pass and read query params from the URL. Let's say you have a Table component and on row select you want users to be transferred to the Details page of a specific record. This can be achieved using the Navigation action step.
Check out the instruction below👇
First, navigate to the Pages tab in the left side panel and create a new page (we'll name it Customer since it will display customer details).
Select your Table component and navigate to the Triggers section.
For the On Row Select trigger, click Create action to create a new action navigating to the Customer page.
Select the Navigate action step and set the destination page as {{routes.customer.url}}
.
Next, in the Query params specify the following:
id = {{ui.customersTable.selectedRow.data.customer_id}}
.
Now, go back to the Customer page and add a Detail component there to display the data of a selected record from the table.
Create a new action of the Load Row type for your current Table.
In the Filters section, for customer_id specify the following variable to receive the URL query parameter on the child page:
{{activeRoute.queryParams.id}}
Assign the Load Row action to the Detail component.
That's it! Now, when selecting a row in the Table, you'll immediately navigate to the child page with the selected customer displayed.
This option can be also useful when creating a redirect after a form submit.