Skip Navigation

[Resolved] Trigger wpv-sort-orderby by select change

This thread is resolved. Here is a description of the problem and solution.

Problem:
Trigger wpv-sort-orderby by select change

Solution:

You can find the proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/trigger-wpv-sort-orderby-by-select-change/#post-1168807

Relevant Documentation:
https://toolset.com/documentation/user-guides/allowing-visitors-to-sort-the-front-end-results/#how-to-add-sorting-controls

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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 9 replies, has 2 voices.

Last updated by umbertoZ 5 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#1168545

Hi, I've a parametric search with "Search" button and AJAX active. I've also added a [wpv-sort-orderby] select outside of the "Search and Pagination" editor, it is on top of Loop editor. The "order by" select works correctly when I click on the "Search" button.

I'd like to order results on select change, without "Search" button click. Is it possible? Is there a jQuery that can help?

I tried this:

  jQuery( ".js-wpv-sort-control-orderby" ).change(function() {
    jQuery( "form.js-wpv-filter-form-675-TCPID825" ).submit();
  });

It submit correclty the search form, but it reloads the page and it loses the orderby parameter.

I tried also this solution but it doesn't work for me:

https://toolset.com/forums/topic/select-menu-dropdown-with-no-submit-button-on-custom-searches-possible/

Can you help me?

thanks

#1168739

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - Could you please share Edit page screenshot of the view?

#1168752
Loop.PNG
Search.PNG

Hi Minesh, I attach a cople of screenshot, but if you want to give a look to wp-admin, this is still the same website I was working on this other topic:

https://toolset.com/forums/topic/split-use-non-types-custom-fields-of-yith-tickets-plugin-for-search-filters-date-filter/

This is the view:
/wp-admin/admin.php?page=views-editor&view_id=675

You can see it on the homepage.

thanks

#1168774

Minesh
Supporter

Languages: English (English )

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

Well - I do not know why you added the sorting control within the "Loop Editor" section, I just placed the sorting control AFTER the shortcode [/wpv-filter-controls] within the "search and pagination" section thats the correct place to add sorting controls as per our Docs:
=> https://toolset.com/documentation/user-guides/allowing-visitors-to-sort-the-front-end-results/#how-to-add-sorting-controls

I can see its working without clicking on search button. Could you please confirm.

#1168784

Ok, but please can you save again the view with your changes? I was also working there and I lost them.

#1168786

Minesh
Supporter

Languages: English (English )

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

Ok - I've added my changes again.

Additionally - Please close the following ticket as well.
https://toolset.com/forums/topic/split-use-non-types-custom-fields-of-yith-tickets-plugin-for-search-filters-date-filter/#post-1168765

#1168790

Minesh
Supporter

Languages: English (English )

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

did you see the changes I made?

#1168797

Yes, it's ok. Thanks.

If I need to put the orderby select outside [wpv-filter-start hide="false"], is there a way to trigger the orderby without click on the search button?

#1168807

Minesh
Supporter

Languages: English (English )

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

The only way I see is to set the view to update the results everytime input changes settings as you can see with the following screenshot:
=> hidden link

#1168809

Ok, thank you for your help.