-
Notifications
You must be signed in to change notification settings - Fork 643
Enhance the select field with null value support #294
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: development
Are you sure you want to change the base?
Enhance the select field with null value support #294
Conversation
Hi @ulion, thanks for the PR! This is a sorely needed feature indeed. I'm in the process of merging it, and I created an example page for all of the versions you describe above (The branch is here, don't forget to gulp if you try it https://github.com/Textalk/angular-schema-form/tree/ulion-enhance_select_null_support) It looks nice, but there is one scenario that I'm not sure about:
When I try it does what it says and selects the first option, but it doesn't change the model, I guess using a |
ops, yes, in many scene, the form does not update back to model, but maybe e.g. in some use case, I have text input, but the initial value is null, besides, about the default behaviour of this PR, I'm a little thought, which 2015-03-12 5:50 GMT+08:00 David Jensen notifications@github.com:
Ulion |
Its the behavior of One way is to set defaults in the JSON Schema, but a easy way to update the model from within a field type (in custom types) is to use the service sfSelect(scope.form.key, scope.model, '') //Sets empty string for a specific field
hmmm... that might be. I'll look into it tonight. |
So there is no apply or some call can force the form elements to refresh 2015-03-14 5:29 GMT+08:00 David Jensen notifications@github.com:
Ulion |
Maybe, check the source code for the input directive in angular, it might be that you can trigger a "change" event? https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L1055 The ngModelController also has a couple of functions, But I'm not sure what happens with the model value if viewValue is "", I don't think it does anything. |
That helps, I will test whether the "input" or "change" event would trigger 2015-03-14 6:52 GMT+08:00 David Jensen notifications@github.com:
Ulion |
Just so you know, I had to fix a release before I could get this merged. I want write some user docs etc... but it will come. |
just added a commit on this PR to not change options order of titleMap, 2015-03-21 6:24 GMT+08:00 David Jensen notifications@github.com:
Ulion |
Any estimates on when this feature might get merged? Is there any way I could assist the process? |
@dstelter sorry... no ETA, but it is top of my list now. I've also got half of a merge done. I'll share as soon as possible and then I'd love some help testing it out. |
Hi David - this this get merged in? |
@davidlgj any chance you can find a moment to fill me in on how far you got with this one? |
Angular's select with ngOptions has 3 type about the null value (the value="" options). reference: https://docs.angularjs.org/api/ng/directive/ngOptions
So, above 3 type of use cases are all useful, but current angular-schema-form implement only give use the first use case support. This PR will add the later 2 type of select/ng-options support, so we can do with the null value better in many use cases.
e.g.