Using core-dropdown to select multiple items

折月煮酒 提交于 2019-12-23 01:41:31

问题


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. :)


回答1:


Try closeAttribute or closeSelector. See core-overlay documentation



来源:https://stackoverflow.com/questions/29125583/using-core-dropdown-to-select-multiple-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!