Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ember-form-for & select field default value #41

Closed
marxsk opened this issue Jul 13, 2017 · 4 comments
Closed

ember-form-for & select field default value #41

marxsk opened this issue Jul 13, 2017 · 4 comments

Comments

@marxsk
Copy link
Owner

marxsk commented Jul 13, 2017

When select-field is used with undefined/null value, the first option is shown. But the value is not set to this value unless we change the options.

A solution is to work with '' as with default value in route-action but then we can run into inconsistencies. Additional argument in template should fix that

@marxsk marxsk self-assigned this Jul 28, 2017
@marxsk
Copy link
Owner Author

marxsk commented Aug 2, 2017

addon/components/one-way-select.js:didReceiveAttrs()

...
set(this, 'options', emberArray(options));
if (value === undefined) {
  invokeAction(this, 'update', firstOption);
}

@marxsk
Copy link
Owner Author

marxsk commented Aug 2, 2017

@marxsk
Copy link
Owner Author

marxsk commented Nov 9, 2017

set(this, '_options', emberArray(options));
if (value === undefined) {
Ember.run.later(() => {
invokeAction(this, 'update', firstOption);
});
}

@marxsk
Copy link
Owner Author

marxsk commented Nov 10, 2017

Fixed in my forks of ember-one-way-controls and ember-form-for

@marxsk marxsk closed this as completed Nov 10, 2017
marxsk added a commit to marxsk/ember-one-way-controls that referenced this issue Mar 14, 2018
When select-field is used with undefined/null value, the first option is shown. But the value is not set to this value unless we change the options.

A solution is to work with '' as with default value in route-action but then we can run into inconsistencies. Additional argument in template should fix that

marxsk/picus#41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant