pbauerochse / searchable-option-list

a jquery plugin for a searchable optionlist
MIT License
79 stars 54 forks source link

"Select all" but only for filtered items #23

Open eskimoblood opened 8 years ago

eskimoblood commented 8 years ago

Is there a way to select all items that are matching the filter. And if not, how hard do you think is it to implement this feature.

pbauerochse commented 8 years ago

Right now it is not possible but to implement this feature should be rather simple. I will put that on my TODO list

lalogalindo commented 8 years ago

I made it with this, go to line 997 of sol.js (more or less) and this is what I got.

    selectAll: function () {
        if (this.config.multiple) {
            var $changedInputs = this.$selectionContainer
                .find('input[type="checkbox"]:not([disabled], :checked):visible')
                .prop('checked', true)
                .trigger('change', true);

            this.close();

            if ($.isFunction(this.config.events.onChange)) {
                this.config.events.onChange.call(this, this, $changedInputs);
            }
        }
    },