pbauerochse / searchable-option-list

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

When there is' a disabled option checked on the label allows you to deselect #4

Closed giggios closed 9 years ago

giggios commented 9 years ago
    addSelectionDisplayItem: function (item, $uiInput) {
        var $displaySelectionItem = $('<div class="sol-selected-display-item" />')
                .html(item.label)
                .attr('title', item.tooltip)
                .appendTo(this.showSelectionContainer);

        if (this.useCheckboxes || this.settings.allowNullSelection) {
          if (!$uiInput.prop('disabled')){ //adding if
            $('<span class="sol-quick-delete" />')
                .html(this.settings.texts.quickDelete)
                .on('click', function () {
                    $uiInput
                        .prop('checked', false)
                        .trigger('change');
                    $displaySelectionItem.remove();
                })
                .prependTo($displaySelectionItem);
            }
        }

        item.displaySelectionItem = $displaySelectionItem;
    }
pbauerochse commented 9 years ago

Hi @giggios,

thanks for the hint and the provided fix. I already pushed it to the github repo.

Cheers

Patrick