Skip to content

Commit

Permalink
Auto update search page via AJAX when number of items is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
andmor- committed Sep 30, 2024
1 parent 803ac23 commit 1755146
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@
.select();
});

// Auto reload search on number of results change
// $("[id^=edit-items-per-page]", document).on("change", () => {
// $("[id^=edit-submit-k-centres-search]", document).trigger("click");
// $("[id^=edit-submit-k-centres-search]", document).trigger('facets_filtering');
// });
// Auto reload search on number of results change with AJAX
function registerItemsPerPageHandler() {
$("[id^=edit-items-per-page]", document).on("change", () => {
$("[id^=edit-submit-k-centres-search]", document).trigger("click");
});
}

registerItemsPerPageHandler();

$(document).on("ajaxComplete", () => {
registerItemsPerPageHandler()
});

// Auto expand secondary menu active item
const activeDropdownTgg = $(
Expand Down

0 comments on commit 1755146

Please sign in to comment.