paper-menu with multiple selections, howto deselect all


I use paper-menu with multiple selections (multi). Everything works fine so fare, but with a deselect all method things seems more complicated.

With html

<paper-menu multi selected-values="{{selectedValues}}">...


List<String> selectedValues = [];...

Things got binded, and every iron-select/iron-deselect event results in a correct update of the selectedValues list in dart.

With clear('selectedValues') the list empties and the logic behaves like no selection is done, but in Dartium the items that previous was
selected remains marked as selected.

I have also tried with the selectedItems List or with the foreach deselect with the select method to PaperMenu, but still not successful update
in Dartium.

Anyone with ideas how to implement this?


Found a workaround for the issue with the select method. The menu with selected values can be replaced with a new similar element created with the Dom api. One drawback is the bindings can’t be set up, so these needs to be hacked with get and set methods at the element. Otherwise this seems to work ok. The calls to the Dom api are shown below.

ParticipantMenu oldPm = $$('#id_filterselection') as ParticipantMenu;
ParticipantMenu newPm = document.createElement('participant-menu');

Polymer.dom(parentNode).insertBefore(newPm, oldPm);

Answered By – Jonas Bojesen

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *