From 048ec990b7ea96ed26d5275771091f275bcc96fa Mon Sep 17 00:00:00 2001 From: Wolfgang Meier Date: Mon, 23 Oct 2023 14:39:52 +0200 Subject: [PATCH] Add facet count to combo box dropdowns --- resources/scripts/browse.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/scripts/browse.js b/resources/scripts/browse.js index 11fc10e3..993ee6f8 100644 --- a/resources/scripts/browse.js +++ b/resources/scripts/browse.js @@ -59,6 +59,15 @@ document.addEventListener('DOMContentLoaded', function () { facets.submit(); }); }); + + ev.detail.querySelectorAll('pb-combo-box').forEach((select) => { + select.renderFunction = (data, escape) => { + if (data) { + return `
${escape(data.text)} ${escape(data.freq || '')}
`; + } + return ''; + } + }); }); // if there's a combo box, synchronize any changes to it with existing checkboxes