Mirage Layout - v2.0.0: Remove a selected item from autocomplete doesn't work

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
Abs
Posts: 1
Joined: 29 Nov 2019, 13:47

03 Jul 2021, 23:32

Hi,

After upgrading to Mirage Layout - v2.0.0, we notice that removing a selected item from AutoComplete component (with multiple selection), by clicking on the close icon of the item, doesn't work anymore.
How can we fix this issue ?

Best Regards,

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

05 Jul 2021, 09:59

Hi,

Please delete the 792-835 lines in layout.js file. Some functions that we did not delete in order not to break the compatibility of old PrimeFaces versions caused this issue. It will run stable.

So this lines:

Code: Select all

if(PrimeFaces.widget.AutoComplete) {
    PrimeFaces.widget.AutoComplete.prototype.setupMultipleMode = function() {
        var $this = this;
        this.multiItemContainer = this.jq.children('ul');
        this.inputContainer = this.multiItemContainer.children('.ui-autocomplete-input-token');

        this.multiItemContainer.hover(function() {
                $(this).addClass('ui-state-hover');
            },
            function() {
                $(this).removeClass('ui-state-hover');
            }
        ).click(function() {
            $this.input.focus();
        });

        //delegate events to container
        this.input.focus(function() {
            $this.multiItemContainer.addClass('ui-state-focus');
            $this.jq.addClass('md-inputwrapper-focus');
        }).blur(function(e) {
            $this.multiItemContainer.removeClass('ui-state-focus');
            $this.jq.removeClass('md-inputwrapper-focus').addClass('md-inputwrapper-filled');
            
            setTimeout(function() {
                if($this.hinput.children().length == 0 && !$this.multiItemContainer.hasClass('ui-state-focus')) {
                    $this.jq.removeClass('md-inputwrapper-filled');
                }
            }, 150); 
        });

        var closeSelector = '> li.ui-autocomplete-token > .ui-autocomplete-token-icon';
        this.multiItemContainer.off('click', closeSelector).on('click', closeSelector, null, function(event) {
            if($this.multiItemContainer.children('li.ui-autocomplete-token').length === $this.cfg.selectLimit) {
                if(PrimeFaces.isIE(8)) {
                    $this.input.val('');
                }
                $this.input.css('display', 'inline');
                $this.enableDropdown();
            }
            $this.removeItem(event, $(this).parent());
        });
    };
};

Best Regards,

Post Reply

Return to “Mirage - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests