Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Problem with multiple ui-select and ui-disable-choice #1200

Closed
ludydoo opened this issue Sep 20, 2015 · 1 comment · Fixed by #1712
Closed

Problem with multiple ui-select and ui-disable-choice #1200

ludydoo opened this issue Sep 20, 2015 · 1 comment · Fixed by #1712

Comments

@ludydoo
Copy link

ludydoo commented Sep 20, 2015

When using the ui-disable-choice attribute, the plugin will add the _uiSelectChoiceDisabled property directly to the option model to store if the option is disabled or not. So, when two ui-select share the same list of object, options will be disabled in both ui-select. This is not desirable because a different ui-disable-choice attribute might be defined for different ui-select that share the same data.

A hack would be to clone the options object. But is it possible to have a better fix than that?

Is it possible that this attribute be _uiSelectChoiceDisabled-{{UNIQUE ID OF UI-SELECT}}, that would permit to disable the option only in the given ui-select?

Check this http://plnkr.co/edit/WD8eEo?p=info

For a given Transaction, there is an Account and a Category defined.
Both Account and Category options are issued from the same list. An Account is a Category and vice-versa.

The Category ui-select-choice tag has the ui-disable-choice attribute set to a function that disables the Category if this Category has the same id property as the Account id property.

  1. Select "Category 1" as the account
  2. Select "Category 2" as the category
  3. Select "Category 2" as the account
  4. Try to select "Category 1" as the account (doesn't work)
@arseneoaa
Copy link

+1
This is related to bug #656

user378230 added a commit to user378230/ui-select that referenced this issue Jul 8, 2016
Previously the item from the list was modified with the
_uiSelectChoiceDisabled property. This allowed a leakage of information
from ui-select to outside the directive. It also caused issues when the
was used outside of the directive.

This commit adds a reference array to store disabled items and so
prevents the need to modify the item in place.

Closes angular-ui#1200 and angular-ui#1661

Partially supersedes angular-ui#1641
user378230 added a commit to user378230/ui-select that referenced this issue Jul 9, 2016
Previously the item from the list was modified with the
_uiSelectChoiceDisabled property. This allowed a leakage of information
from ui-select to outside the directive. It also caused issues when the
was used outside of the directive.

This commit adds a reference array to store disabled items and so
prevents the need to modify the item in place.

Closes angular-ui#1200 and angular-ui#1661

Partially supersedes angular-ui#1641
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants