@@ -590,6 +590,27 @@ $(function () {
590590 // Listener for search button.
591591 $ ( '#adj_search_button' ) . click ( loadSearch ) ;
592592
593+ // Listener for clear button.
594+ $ ( '.clear-values' ) . each ( function ( ) {
595+ $ ( this ) . click ( function ( ) {
596+ // Clear the search form and clear URL parameters
597+ let search_params = new URLSearchParams ( window . location . search ) ;
598+ 599+ $ ( this ) . closest ( '.form-row' ) . find ( 'input' ) . each ( function ( ) {
600+ $ ( this ) . val ( '' ) ;
601+ search_params . set ( $ ( this ) . attr ( 'name' ) , '' ) ;
602+ } ) ;
603+ $ ( this ) . closest ( '.form-row' ) . find ( 'select' ) . each ( function ( ) {
604+ $ ( this ) . val ( '' ) ;
605+ search_params . set ( $ ( this ) . attr ( 'name' ) , '' ) ;
606+ } ) ;
607+ 608+ // Update the URL with cleared values
609+ var new_url = 'adj?' + search_params . toString ( ) ;
610+ window . history . pushState ( { path : new_url } , '' , new_url ) ;
611+ } ) ;
612+ } ) ;
613+ 593614 // initialize the grid and search
594615 let search_params = new URLSearchParams ( window . location . search ) ;
595616 var repeated_fields = [
0 commit comments