1👍
You can listen to cellKeyDown
event from AgGridVue
like so:
<AgGridVue
style="height: 100vh; width: 100%"
class="ag-theme-alpine"
:columnDefs="columnDefs"
:rowData="rowData"
@cellKeyDown="onKeyDownHandler($event)"
/>
And add method/function:
function onKeyDownHandler(params) {
const { colId } = params.column;
if (colId === 'isValid' && params.event.code === 'Space') {
params.node.setDataValue(colId, !params.value);
}
}
That checks if key was pressed in your isValid
column, and that it is Space
key, if it is, it toggles the cells value.
Here’s a quick sandbox/stackblitz: https://stackblitz.com/edit/vue-khblqw?file=src/App.vue
- [Vuejs]-Sorting array coming from computed property, in a method also sorts the original array (that comes from the computed property)
- [Vuejs]-Javascript: Remove Item from Array
Source:stackexchange.com