I have a List of Checkbox groups. Each Checkbox group has a name. I display them by iterating over the list. Now when i want to update the checkboxes for each individual checkbox group (which have the same schema) by using "this", i only get the information about the corresponding checkbox. How can i get the checkboxes group name?
Schema:
CheckboxSchema = new SimpleSchema({
name: {
type: String,
label: "Name"
},
checked: {
type: Boolean,
label: "Checked",
defaultValue: false
}
});
GroupSchema = new SimpleSchema(
listName: {
type: String,
label: "GroupName"
},
checkboxes: {
type: [CheckboxSchema]
}
}]);
In the events i want to access the id of each Checkbox group to pass it to Meteor.call to update the values of each checkbox to its corresponding group.
Template.checkboxGroup.events({
"click .toggle-checked": function(event) {
var self = this;
event.preventDefault();
// Need checkbox group id
Meteor.call("setCheckboxgroup", self._id, !self.checked);
}
});
Thanks in advance! Vin
Aucun commentaire:
Enregistrer un commentaire