Skip Navigation

[Resolved] Clearer search results for the users

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 11 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2686477

hidden link
The search results, i.e. how many records were returned can only be positioned in the Output area and not in the Search area. Since that is way down the page, the user clicks Search or Filter and thinks nothing happened. It needs to be clear that results are returned.

The easiest solution is to take them to the output with an anchor link, i.e. after the search results are returned a javascript function sends them to #list which is here hidden link

But as far as I know there is no way to attach a JS script to an event for the search.

#2686595

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can add the custom JavaScript to your view block:
- https://toolset.com/course-lesson/adding-custom-javascript-to-views-templates-and-archives/#steps-for-adding-javascript-to-a-view

You can even add a ajax javascript hook:
- https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/

The code should look like something:

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
    /**
    * data.view_unique_id (string) The View unique ID hash
    * data.layout (object) The jQuery object for the View layout wrapper
    */
 
 var TopPosition = jQuery('#list').offset().top;
      
 jQuery('html, body').animate({scrollTop:TopPosition }, 'slow');
   
      
});

- You can add the desired JS code to above custom JS hook.

#2686968

It worked like a charm, thank you.