I read the docs yet I can't find any example of a bootstrap vue checkbox being set to check/unchecked when clicking a table row (when it is underneath a table). Is there a way that clicking a row will result to it being checked/unchecked?
data() {
return {
form: {
optional: {} as { [index: string]: boolean },
},
};
},
methods: {
triggerCheckBox(relatedId: string) {
const val = this.form.optional[relatedId];
this.form.optional[relatedId] = !val;
},
}
<tr v-for="related in liability.related" @click="triggerCheckBox(related.id)">
<td>
<b-form-checkbox
v-model="form.optional[related.id]"
</b-form-checkbox>
</td>
Edit: I already manipulated the v-model bind to the checkbox. Still doesn't work.
v-model
). What does your code look like? – Philtrue
doesn't set the checkbox tochecked
. – The Bassmandata()
(iethis.form.optional[relatedId] = !val
) is not reactive. See vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats – Phil