multi-select icon indicating copy to clipboard operation
multi-select copied to clipboard

Select all current items in filtered list

Open blevinson opened this issue 11 years ago • 3 comments
trafficstars

How do I select all of the current filtered items after search filter is applied?

blevinson avatar Feb 26 '14 04:02 blevinson

If you look at the searchable demo on the site, you can select all filtered items with: $('#ms-511multiselect .ms-selectable .ms-list li[style=""]'). All filtered elements have the style attribute empty, while the others are not visible (display:none).

chrisvoo avatar Feb 23 '15 10:02 chrisvoo

In my case it is: $("#ms-pre-selected-options .ms-elem-selection.ms-selected") but if you want to see a Value as well as Text property, add a custom attribute with your value to an option markup.

dotsad avatar Aug 13 '15 00:08 dotsad

Assuming your select has a select-list id and "Select all" button has a select-all id, you can do the following:

$('#select-all').click(function(){
  $('#ms-select-list .ms-elem-selectable').not(':hidden').each(function() {
    $('#select-list').multiSelect('select', [$(this).data('ms-value')]);
  });
  return false;
});

What it does is going through the items in the selectable list, except the filtered ones (which are hidden), and add them to the selected list.

dchatry avatar Nov 05 '18 12:11 dchatry