Ember-power-select: [Enhancement] Add ability to hide selected options from (multiple select) dropdown

Created on 2 Dec 2016  路  1Comment  路  Source: cibernox/ember-power-select

In some cases you want to hide the objects that are already added to the selection from your options in the dropdown. This currently can be achieved with the following css rule:

.ember-power-select-multiple-trigger~.ember-view ul>.ember-power-select-option[aria-selected="true"] {
  display:none;
}

However, this seems rather hacky. We maybe should consider an easier way to hide these items.

Most helpful comment

This is already doable. I do it all the time actually.

{{#power-select-multiple options=optionsWithoutSelected selected=selected onchange=(actions (mut selected)) as |opt|}}
  {{opt}}
{{/ember-power-select}}
optionsWithoutSelected: computed('options', 'selected', function() {
  return this.get('options').filter((o) => !selected.includes(o));
})

>All comments

This is already doable. I do it all the time actually.

{{#power-select-multiple options=optionsWithoutSelected selected=selected onchange=(actions (mut selected)) as |opt|}}
  {{opt}}
{{/ember-power-select}}
optionsWithoutSelected: computed('options', 'selected', function() {
  return this.get('options').filter((o) => !selected.includes(o));
})
Was this page helpful?
0 / 5 - 0 ratings

Related issues

angelosarto picture angelosarto  路  8Comments

davelowensohn picture davelowensohn  路  4Comments

jorkas picture jorkas  路  8Comments

Keeo picture Keeo  路  10Comments

knownasilya picture knownasilya  路  10Comments