I'm trying to bind elements of one array to the checked attribute of checkboxes using Ember 2.8. I'm also using this in one component.
The checkboxes show all marked, but whenever I tried to use the action hideOrShowAllColumns
it does not mark all checkboxes again if there was one which was not checked... so I guess I'm passing the value of the array element and not the element itself. I don't know how to do this in javascript/ember...
This is my view
All
This is my component.js
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.set('allColumnsChecked', true);
},
didReceiveAttrs() {
this._super(...arguments);
let columnMap = this.get('columnMap');
let allColumns = Array(columnMap.length).fill(true);
this.set('allColumns', allColumns);
},
actions: {
hideOrShowAllColumns() {
let all = this.get('allColumnsChecked');
all = !all;
this.set('allColumnsChecked', all);
if (all === true) {
let allColumns = this.get('allColumns');
allColumns = allColumns.map(() => true);
this.set('allColumns', allColumns);
}
},
}
Helper getItemAt
export function getItemAt(params) {
return params[0][params[1]];
}
Aucun commentaire:
Enregistrer un commentaire