selectivity icon indicating copy to clipboard operation
selectivity copied to clipboard

multiple selection no X button

Open signmeuptwice opened this issue 6 years ago • 1 comments

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 ?

signmeuptwice avatar Dec 26 '18 15:12 signmeuptwice

@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

imgntn avatar May 24 '19 23:05 imgntn