Skip to content

Commit

Permalink
Merge pull request #612 from marmelab/deselect
Browse files Browse the repository at this point in the history
[RFR] Allow deselection to send null value in choice field
  • Loading branch information
fzaninotto committed Aug 24, 2015
2 parents bfa6cb0 + b1071d4 commit 9fb02d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/javascripts/ng-admin/Crud/field/maChoiceField.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ function maChoiceField($compile) {
var field = scope.field();
scope.name = field.name();
scope.v = field.validation();
scope.$watch('value', function(newValue, oldValue) {
if (newValue !== oldValue && newValue === undefined) {
// fix for https://github.com/angular-ui/ui-select/issues/863
scope.value = null;
}
});

var refreshAttributes = '';
if (field.type().indexOf('reference') === 0 && field.remoteComplete()) {
Expand Down
4 changes: 4 additions & 0 deletions src/sass/ng-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ div.bottom-loader {
*/
.form-horizontal {

.has-feedback .form-control.ui-select-toggle {
padding-right: 12px;
}

textarea {
height: 150px;
}
Expand Down

0 comments on commit 9fb02d9

Please sign in to comment.