FIX: makes sure the combo-box selects the first value

This commit is contained in:
Joffrey JAFFEUX 2017-10-30 01:28:11 -07:00 committed by GitHub
parent 71cea12ee2
commit 43920827ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,8 @@ export default buildCategoryPanel('security', {
permission: PermissionType.create({ id: parseInt(id) }) permission: PermissionType.create({ id: parseInt(id) })
}); });
} }
this.set('selectedGroup', this.get('category.availableGroups.firstObject'));
}, },
removePermission(permission) { removePermission(permission) {

View File

@ -481,12 +481,13 @@ export default Ember.Component.extend(UtilsMixin, DomHelpersMixin, KeyboardMixin
const none = isNone(this.get("none")); const none = isNone(this.get("none"));
const emptyValue = isEmpty(this.get("value")); const emptyValue = isEmpty(this.get("value"));
const notEmptyContent = !isEmpty(this.get("content"));
if (none && emptyValue && notEmptyContent) { if (none && emptyValue) {
Ember.run.scheduleOnce("sync", () => { Ember.run.scheduleOnce("sync", () => {
const firstValue = this.get(`content.0.${this.get("valueAttribute")}`); if (!isEmpty(this.get("computedContent"))) {
this.set("value", firstValue); const firstValue = this.get("computedContent.firstObject.value");
this.set("value", firstValue);
}
}); });
} }
} }