Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

multiple selection no X button #259

Open
signmeuptwice opened this issue Dec 26, 2018 · 1 comment
Open

multiple selection no X button #259

signmeuptwice opened this issue Dec 26, 2018 · 1 comment

Comments

@signmeuptwice
Copy link

signmeuptwice commented Dec 26, 2018

I use selectivity over a php generated <select>

I have no cross (X) button in my selected items like on the project page; did I miss an option somewhere?

$('#tag-list').selectivity({ multiple: true, placeholder: 'Add tags' });

also is it possible for the user to add something not in the list ?

@imgntn
Copy link

imgntn commented May 24, 2019

@signmeuptwice it seems like the fa-remove alias was removed between FA 4 and FA 5.

The quickest fix is to copy the template code for multipleSelectedItem from templates.js and change fa-remove to fa-times like so

$.Selectivity.Templates.multipleSelectedItem=function(options){
      var extraClass = options.highlighted ? ' highlighted' : '';
      return (
          '<span class="selectivity-multiple-selected-item' +
          extraClass +
          '" ' +
          'data-item-id="' +
          escape(options.id) +
          '">' +
          (options.removable
              ? '<a class="selectivity-multiple-selected-item-remove">' +
                '<i class="fa fa-times"></i>' +
                '</a>'
              : '') +
          escape(options.text) +
          '</span>'
      );
    }

You could also patch your selectivity.js file with the change to the FA name

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants