I am trying to find a way to reset a form inside a dialog back to some default data after the dialog is closed/abandoned.
Say collaborators
is a list from the server, each with an associated privilege level. My form provides a way to edit their privilege. If they abandon the dialog (without clicking submit), it should revert to their saved privilege, no matter what they selected in the dropdown.
When they abandon the dialog, I try doing this.$.users.render()
to force the dom-repeat to re-compute _computeDropdown
(which returns a paper-item index) and get rid of the user selection, even though items
hasn't changed.
But render
doesn't call the computed binding. Am I overlooking another way to reset the selection to default data here?
<template id="users" is="dom-repeat" items="[[ collaborators ]]">
<div class="field">
<paper-input disabled name="collaborator" label="[[ item.name ]]"></paper-input>
<paper-icon-button icon="close" on-tap="remove"></paper-icon-button>
<paper-dropdown-menu name="privilege">
<paper-listbox class="dropdown-content" selected="[[ _computeDropdown(item.privilege) ]]">
<paper-item>Owner</paper-item>
<paper-item>Collaborator</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</template>