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

Option to append multiselect list to body

Open andrewboni opened this issue 9 years ago • 5 comments

Is there a way to append this to the body of the page? This is useful for situations where the multiselect list is inside of a container or other element and subsequently gets cut off.

andrewboni avatar Aug 26 '15 01:08 andrewboni

Hi @andrewboni ,

Sorry for the late reply. Have you managed to find a solution?

isteven avatar Sep 22 '15 14:09 isteven

Not yet, have just been postponing dealing w/ this for now

andrewboni avatar Sep 23 '15 01:09 andrewboni

+1

zamboney avatar Oct 19 '15 12:10 zamboney

I got similar issue. I have multiselect box inside bootstrap panel bottom. Which is cutting down the dropdown list.

pankajparkar avatar Dec 22 '15 15:12 pankajparkar

I found a temporary solution that seems that is working. The dropdown menu, that is produced by the isteven-multi-select, contains the class 'checkboxLayer'.

So, i add the following css rule:

.modal-dialog .checkboxLayer.show {
    position: fixed;
}

Of course this creates some side effects in case that the dropdown is inside a scrolled view. What i propose as solution, in this kind of issues, is to watch the scroll event and update the fixed position of the dropdown considering the offset of the isteven-multi-select. My implementation is the following:

var dropdownTopOffset = 20;

var istevenElement = $('our isteven-multi-select element');
var criteriaSearchValuesElement = istevenElement.closest('parent element that wrappes the scroll view');

var updateIstevenMultiSelectsDropdownPosition = function() {
    var offset = istevenElement.offset();
    var checkboxLayerElement = istevenElement.find('.checkboxLayer');
    checkboxLayerElement.css('top', offset.top + dropdownTopOffset);

    if (checkboxLayerElement.hasClass('show')) {
        closeElementIfNotInView(checkboxLayerElement);
    }
};

var closeElementIfNotInView = function(checkboxLayerElement) {
    var parentTop = criteriaSearchValuesElement.offset().top;
    var parentHeight = criteriaSearchValuesElement.height();
    var top = checkboxLayerElement.offset().top;

    if (top < parentTop || top > parentTop + parentHeight) {
        checkboxLayerElement.scope().toggleCheckboxes();
    }
}

criteriaSearchValuesElement.scroll(updateIstevenMultiSelectsDropdownPosition);

updateIstevenMultiSelectsDropdownPosition();

apostolidhs avatar Feb 22 '16 13:02 apostolidhs