Forums Forums Search & Filter Pro How to set allowClear to true

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #260912

    Hey guys,

    I want to set all the boxes to allowClear true so that they get similar styling. I think it looks a lot cleaner this way. But it looks like there is something going on that is not allowing this to happen.

    Here is the code I am trying. I have also tried to just add the data-attribute to the select element through jquery but it doesnt work either.

    It will add the X’s to my boxes, but it will only clear the selections from the multibox. On the other boxes it throws a cannot ready property of undefined error.

    I can leave a link to my dev site along with the UN/PW to get in in a private reply.

    
    $.fn.select2.defaults.set( "allowClear", "true" );
      $('select.sf-input-select').select2({
        allowClear: "true"
      });
    
      $(document).on('sf:ajaxfinish', '.searchandfilter', function() {
        $('select.sf-input-select').select2({
          allowClear: "true"
        });
      });
    
    Anonymous
    #260913
    This reply has been marked as private.
    Trevor
    #261025

    This is not something I have tried before, but does this StackOverflow answer help?

    https://stackoverflow.com/questions/19766025/select2-allowclear-not-enabled-when-options-set-dynamically

    Anonymous
    #261150

    Hey Trevor,

    That was it. Your google fu is strong.

    Thanks!

    Trevor
    #261156

    Thanks for getting back to me. I will close this thread for now.

Viewing 5 posts - 1 through 5 (of 5 total)