Skip to content

Commit

Permalink
feat(md-select): add disabled property and functionality, closes #190
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Jun 6, 2016
1 parent 12e6904 commit 3bfc9c8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/select/select.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { customAttribute } from 'aurelia-templating';
import { bindable, customAttribute } from 'aurelia-templating';
import { BindingEngine } from 'aurelia-binding';
import { inject } from 'aurelia-dependency-injection';
import { TaskQueue } from 'aurelia-task-queue';
Expand All @@ -8,6 +8,7 @@ import { fireEvent } from '../common/events';
@inject(Element, LogManager, BindingEngine, TaskQueue)
@customAttribute('md-select')
export class MdSelect {
@bindable() disabled = false;
_suspendUpdate = false;
subscriptions = [];

Expand Down Expand Up @@ -43,6 +44,22 @@ export class MdSelect {
});
}

disabledChanged(newValue) {
let $wrapper = $(this.element).parent('.select-wrapper');
if ($wrapper.length > 0) {
if (newValue) {
$('.caret', $wrapper).addClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', 'disabled');
$wrapper.attr('disabled', 'disabled');
} else {
$('.caret', $wrapper).removeClass('disabled');
$('input.select-dropdown', $wrapper).attr('disabled', null);
$wrapper.attr('disabled', null);
$('.select-dropdown', $wrapper).dropdown({'hover': false, 'closeOnClick': false});
}
}
}

notifyBindingEngine() {
this.log.debug('selectedOptions changed', arguments);
}
Expand Down

0 comments on commit 3bfc9c8

Please sign in to comment.