Hi again.
On this site, we have a custom search form on the left.
After reload, everything is fine, incl. the JQuery that deactivates in "... Fächer" one option ("Kern"/"Rand",...) when activating another option of the same subject (Fach). (See what I mean?)
After firing the search once or twice, JQuery seems to be broken.
Can you tell me why?
Thank you, kind regards,
Achim
If the custom jQuery manipulates filters, you may need to trigger it again after the filters update. When results are updated, typically the filters are overwritten as well so any options you changed before update may need to be changed again. We have a couple of JS events available for you to use as "hooks" to trigger your custom code. In the legacy View editor's Search and Pagination editor, you will find a JS panel. Open the panel, and you will find a Front-end JS events button. Click that button to generate the appropriate event hook syntax. For example, the event hooks fired when the search form is updated (input update automatically when filters change) and when the search results are updated:
jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.view_changed_form (object) The jQuery object for the View form after being updated
* data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode
* data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode
*/
// add your code here
});
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
*/
// add your code here
});
If using the Blocks Editor to design your View, you can copy+paste the code examples above in the View's custom JS panel, since there is no Front-end Events button to generate the code automatically.
Hi Christian,
we´re looking into this.
Probably takes some days - sorry.
Thank you, kind regards,
Achim
Okay I will stand by for your update.