Persist Filters Easily with Lucid's Query String Method

Learn how to simplify pagination by persisting active filters with the query string method. Follow this step-by-step guide to clean up your code, apply the .queryString method from Lucid, and ensure seamless pagination for your web applications.

Published
May 23
Duration
3m 58s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

00:00 - Current Pagination Approach

  • Explanation of current method: manually appending filters to pagination URLs

00:16 - Overlooked Method

  • Introduction to an overlooked method to simplify pagination

  • Removal of the query string module from Node.js

00:29 - Code Cleanup

  • Steps to remove the existing query string logic from the code

  • Cleaning up imports and looping mechanisms

00:51 - New Pagination Method

  • Introduction of the .queryString method from Lucid's simple paginator

  • Implementation of the new method to handle key-value pairs for pagination

01:08 - Applying Changes to Watchlists Controllers

  • Application of the new method to the watchlist controller

  • Removal of old query string code from the watchlist controller

01:26 - Movies Controller Updates

  • Repeating the process for the movies controller

  • Removal of old query string logic from the movies controller

01:45 - Updating Pages

  • Updating the movies index page to remove query string logic

  • Ensuring the new method is applied to all pagination links (first, previous, next, last)

02:15 - Validation and Testing

  • Checking for any remaining use of the query string

  • Validation that filters are correctly applied

  • Testing in the browser to ensure everything works correctly with the new method

02:48 - Logging In and Further Testing

  • Logging in to test user functionality

  • Applying filters and navigating through pages to confirm persistence of filters

Join The Discussion! (0 Comments)

Please sign in or sign up for free to join in on the dicussion.

robot comment bubble

Be the first to Comment!