Currently on the w-list we have the method applySelectionOnItems which is called when the modelValue is changed from the watch method. Which can update the _selected property on the items to true but can not currently set it to false. This means that we can not modify the list of selected values to remove an item and have it de-select the value.
Here is a Codepen that demonstrates the issue. Note that when you click a button to select list item one we get the update, but when we remove the item we don't get the list updating correctly.
This pull request inverts the looping logic where it iterates over each listItems and checks to see if they exist in the array returned from checkSelection and updates the _selected value based upon whether it was found or not.
Currently on the
w-list
we have the methodapplySelectionOnItems
which is called when themodelValue
is changed from thewatch
method. Which can update the_selected
property on the items totrue
but can not currently set it to false. This means that we can not modify the list of selected values to remove an item and have it de-select the value.Here is a Codepen that demonstrates the issue. Note that when you click a button to select list item one we get the update, but when we remove the item we don't get the list updating correctly.
This pull request inverts the looping logic where it iterates over each
listItems
and checks to see if they exist in the array returned fromcheckSelection
and updates the_selected
value based upon whether it was found or not.