Skip Navigation

[Resolved] Select2 Multiselect

This support ticket is created 4 years, 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Michelle Dodd 4 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1667561

Hello,
I am loading Select2 multiselect with a CDN to display options built with Toolset. On page load, the Select box becomes a Select2 box, but after you choose a selection, it reverts back to a regular html multiselect box.

The page is hidden link
Password: potential

Here is the code from my external .js file:
$(document).ready(function() {
jQuery('.js-wpv-filter-trigger').select2();
});

#1668027

Hi Michelle,

Thank you for contacting us and I'd be happy to assist.

The custom script that you've shared only executes the Select2 script, when the page loads or re-loads.

Since the view is set to update the results and pagination through AJAX (i.e. without reloading the page), you'll need to update that script, so that it is also executed when the pagination updates, when the search form updates and when the search results update, through AJAX:


( function( $ ) {
	$( document ).on( 'ready js_event_wpv_pagination_completed js_event_wpv_parametric_search_form_updated js_event_wpv_parametric_search_results_updated', function( event, data ) {
		$('.js-wpv-filter-trigger').select2();
	});
})( jQuery );

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1668417

My issue is resolved now. Thank you!