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

keep order not working with events afterSelect and afterDeselect

Open rodrigosaraiva opened this issue 7 years ago • 2 comments

I have this code and keepOrder not works with events. I removed the refresh method at the end of events.

    $('#dimension_types_ids').multiSelect({
        keepOrder: true,
        afterSelect: function (value) {
            a_dimension_types_ids.push(Number(value));
            if (a_dimension_types_ids.length > 1) {
                $('#dimension_types_ids option').not(':selected').prop('disabled', true);
            } else {
                $('#dimension_types_ids option').not(':selected').prop('disabled', false);
            }
        },
        afterDeselect: function (value) {
            let index = a_dimension_types_ids.indexOf(Number(value));
            if (index > -1) {
                a_dimension_types_ids.splice(index, 1);
            }
            if (a_dimension_types_ids.length > 1) {
                $('#dimension_types_ids option').not(':selected').prop('disabled', true);
            } else {
                $('#dimension_types_ids option').not(':selected').prop('disabled', false);
            }
        },
    });

rodrigosaraiva avatar Jun 09 '17 16:06 rodrigosaraiva

Same problem here. Did you find a solution?

ghost avatar Jun 28 '17 15:06 ghost

No. I give up from this component. I did not have time to check multi-select code for my project. And I think this project is kinda like abandoned. So I am using select2 now.

rodrigosaraiva avatar Jun 28 '17 15:06 rodrigosaraiva