-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__checkbox column disabled based on row value #510
Comments
@AngeloAnolin Sorry, my suggestion in #286 was a bit vague. The suggestion was actually not to use I think the implementation of But if you would like to do that I would suggest you look at Field Component in v2.0-beta of Vuetable-2 as it allows you to create your own component. You can even extend the existing If you look at |
How can we provide a limit to the number of selected check boxes. Say we want to restrict the limit to one? @ratiw |
I created a MyVuetableFieldCheckbox.vue <template>
<th v-if="isHeader"
class="vuetable-th-component-checkbox"
>
<input type="checkbox"
@change="toggleAllCheckbox($event)"
:checked="isAllItemsInCurrentPageSelected()"
>
</th>
<td v-else
class="vuetable-td-component-checkbox"
>
<input type="checkbox"
:disabled="rowField.disabledId(rowData)"
@change="toggleCheckbox(rowData, $event)"
:checked="isSelected(rowData)"
>
</td>
</template>
<script>
import VuetableFieldCheckboxMixin from 'vuetable-2/src/components/VuetableFieldCheckboxMixin.vue'
export default {
name: 'vuetable-field-checkbox',
mixins: [VuetableFieldCheckboxMixin],
}
</script> then use it like <template>
<vuetable
:fields="col_fields"
...
>
</vuetable>
</template>
<script>
import VuetableFieldCheckbox from "../../Components/MyVuetableFieldCheckbox"
export default {
data() {
return {
col_fields: [
{
name: VuetableFieldCheckbox,
disabledId: function(rowData) {
return rowData.cancelled == 1? true : false
}
},
]
}
}
}
</script> |
I know this has been asked on this issue # 289.
But I am unsure how to implement the row-class to disable the checkbox column for a specific row.
On the row-class wiki it says, you can define a method and it applies a class that is applied to the row itself. How do I return a class that would only be defined for the checkbox column itself?
Appreciate any insight. Thanks.
The text was updated successfully, but these errors were encountered: