lordfriend/nya-bootstrap-select

With Action Box & Multiple options, Select All and Deselect All does not work

jisuo opened this issue · 3 comments

jisuo commented

I use a dropdown with multiple and action box like this

       <ol class="nya-bs-select"
          ng-model="$ctrl.contactIds"
          title="Choose Existing Contact"
          actions-box="true"
          multiple
          data-size="5"
          data-live-search="true">
          <li nya-bs-option="contact in $ctrl.contacts"
            data-value="contact.id">
            <a>
              {{ contact.name }}
            </a>
          </li>
        </ol>

The Select All and Deselect All buttons does not work since they use jqLite and .find() using class selectors. jqLite does not support that.

Code from `nya-bs-select.js below:

// map global property to local variable.
var jqLite = angular.element;

...

actionsBox = jqLite(ACTIONS_BOX);
dropdownContainer.append(actionsBox);

...

// actions box
if ($attrs.actionsBox === 'true' && isMultiple) {
  actionsBox.find('.bs-select-all').on('click', function () {
    setAllOptions(true);
  });

  actionsBox.find('.bs-deselect-all').on('click', function () {
    setAllOptions(false);
  });
}

actionsBox.find('.bs-deselect-all') does not work.

jisuo commented

Okay, I found the issue. The NPM package https://www.npmjs.com/package/nya-bootstrap-select uses old version 2.0.11. On github I see v2.5.1.

Could the NPM package be updated?

jisuo commented

Ok, nvm. Reading is good thing to do. Front page here says to use @lordfriend/nya-bootstrap-select.

Sorry for this confusion on npm package namespace, The NPM package https://www.npmjs.com/package/nya-bootstrap-select is published by another user before I publish this project on npm. So I have to publish under my namespace.