Last active
May 28, 2016 22:59
-
-
Save villander/f55765a970baae23bcd4de2eb8d81810 to your computer and use it in GitHub Desktop.
clear all checkbox's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['box-field'], | |
isCheckedObserver() { | |
this.send('toggleSelectItem', this.get('item')); | |
}, | |
init() { | |
this._super(...arguments); | |
this.addObserver('item.isChecked', this, this.isCheckedObserver); | |
}, | |
willDestroy() { | |
this.removeObserver('item.isChecked', this, this.isCheckedObserver); | |
}, | |
actions: { | |
toggleSelectItem(item) { | |
this.sendAction('toggleSelectItem', item); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
selection:[], | |
amountsCheckboxs: [ | |
Ember.Object.create({id: "check-quantidades", label: "Todas as quantidades", isChecked: false}), | |
Ember.Object.create({id: "check-54diarias", label: "5 dias/ 4 diarias", isChecked: false}), | |
Ember.Object.create({id: "check-65diarias", label: "6 dias/ 5 diarias", isChecked: false}), | |
Ember.Object.create({id: "check-76diarias", label: "7 dias/ 6 diarias", isChecked: false}), | |
Ember.Object.create({id: "check-87diarias", label: "8 dias/ 7 diarias", isChecked: false}), | |
Ember.Object.create({id: "check-98diarias", label: "9 dias/ 8 diarias", isChecked: false}), | |
Ember.Object.create({id: "check-109diarias", label: "10 dias/ 9 diarias", isChecked: false}) | |
], | |
actions: { | |
clearFilter() { | |
this.get('selection').setEach('isChecked', false); | |
}, | |
toggleSelectItem(item) { | |
console.log(item); | |
//var isChecked = this.get('isChecked'); | |
// DO STUFF! | |
//console.log(isChecked, this.get('itemId')); | |
if (this.get('selection').contains(item)) { | |
this.get('selection').removeObject(item); | |
} else { | |
this.get('selection').pushObject(item); | |
} | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.8.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": true, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.5.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment