TerryZ / v-selectmenu

SelectMenu for Vuejs, A simple, easier and highly customized menu solution
https://terryz.github.io/docs-vue/#/selectmenu
MIT License
187 stars 25 forks source link

Data values cleared when "Select All" chosen twice #15

Closed Sell24 closed 4 years ago

Sell24 commented 5 years ago

Steps to Reproduce:

  1. Create an advanced menu with the multiple choice option.
  2. Choose menu and in "Select Option" popup, click the Select All button (checkbox) twice or more times.
  3. Clear the selections (trash can).
  4. All data values in the list will disappear resulting in the "not found" message.

Just started to look into this, but just thought I would post it to let you know.

Sell24 commented 5 years ago

I looked into the code and from what I can see, it appears that the issue is that you assign the selected array = to the results array in the selectAll() function. This as you probably know does not create a copy but just reference to the original array. Then when the selected array is cleared in clearAll(), it clears the original array. By changing:

this.selected = this.results

to

this.selected = this.results.slice();

it seems to solve the issue.

davs20 commented 5 years ago

Thanks....

TerryZ commented 4 years ago

Fixed in the last release.