简体   繁体   中英

Using core-dropdown to select multiple items

When a user clicks in a report button, they should be able to select one or more types of issues. I'm trying something like this:

<core-icon-button icon="report" on-tap="{{ openDropdown }}">
   <core-dropdown>
      <core-selector valueattr="label" multi>
         <core-item label="Type 1"></core-item>
         <core-item label="Type 2"></core-item>
         <core-item label="Type 3"></core-item>
      </core-selector>
      <button on-tap="{{ reportIssue }}">Report</button>
   </core-dropdown>
</core-icon-button>

But when I select any item the dropdown closes. My expected behaviour would be to close the dropdown only after reportIssue is called.

Is what I'm trying to do possible with core-dropdown (or any other core element) or should I build a custom element for this? Feels like a waste since almost all the behaviour I need is provided already by core-dropdown .

EDIT: The problem seems to be that I had core-dropdown inside core-icon-button . After I changed that everything works as expected. :)

Try closeAttribute or closeSelector . See core-overlay documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM