From be677a1c99223e6159c3827f7d59dff0afa27b67 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 11 Feb 2020 15:07:25 -0500 Subject: [PATCH] Select2 - Use description as title for each option --- js/Common.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/Common.js b/js/Common.js index 47c6e48b18..8888e72d59 100644 --- a/js/Common.js +++ b/js/Common.js @@ -404,6 +404,7 @@ if (!CRM.vars) CRM.vars = {}; return $(this).each(function() { $(this) .removeClass('crm-ajax-select') + .off('.crmSelect2') .select2('destroy'); }); } @@ -439,6 +440,13 @@ if (!CRM.vars) CRM.vars = {}; }; } + // Use description as title for each option + $el.on('select2-loaded.crmSelect2', function() { + $('.crm-select2-row-description', '#select2-drop').each(function() { + $(this).closest('.select2-result-label').attr('title', $(this).text()); + }); + }); + // Defaults for single-selects if ($el.is('select:not([multiple])')) { settings.minimumResultsForSearch = 10; -- 2.25.1