Skip to content

Commit aba81cb

Browse files
committed
Add selectAll event
1 parent d35c972 commit aba81cb

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "HC200ok",
44
"description": "A customizable and easy-to-use data table component made with Vue.js 3.x.",
55
"private": false,
6-
"version": "1.5.40",
6+
"version": "1.5.41",
77
"types": "./types/main.d.ts",
88
"license": "MIT",
99
"files": [

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<!-- <ServerSideMode /> -->
2+
<ServerSideMode />
33
<br><br>
4-
<ClientMode />
4+
<!-- <ClientMode /> -->
55
<br><br>
66
<!-- <ExpandLoading/> -->
77
</template>

src/components/DataTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ const emits = defineEmits([
410410
'update:serverOptions',
411411
'updatePageItems',
412412
'updateTotalItems',
413+
'selectAll'
413414
]);
414415
415416
const isMultipleSelectable = computed((): boolean => itemsSelected.value !== null);

src/hooks/useTotalItems.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default function useTotalItems(
137137

138138
const toggleSelectAll = (isChecked: boolean): void => {
139139
selectItemsComputed.value = isChecked ? totalItems.value : [];
140+
if (isChecked) emits('selectAll');
140141
};
141142

142143
const toggleSelectItem = (item: Item):void => {

src/modes/ServerSide.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
border-cell
2727
multi-sort
2828
@update-sort="updateSort"
29+
@select-all="selectAll"
2930
>
3031
<template #expand="item">
3132
<div style="padding: 15px">
@@ -134,6 +135,10 @@ export default defineComponent({
134135
135136
const loading = ref(false);
136137
138+
const selectAll = () => {
139+
console.log("sssss")
140+
}
141+
137142
const loadFromServer = async () => {
138143
loading.value = true;
139144
const {
@@ -215,6 +220,7 @@ export default defineComponent({
215220
updatePage,
216221
bodyRowClassName,
217222
updateSort,
223+
selectAll,
218224
};
219225
},
220226

src/types/internal.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export type ClickEventType = 'single' | 'double'
2626
export type MultipleSelectStatus = 'allSelected' | 'noneSelected' | 'partSelected'
2727

2828
// eslint-disable-next-line max-len
29-
export type EmitsEventName = 'clickRow' | 'selectRow' | 'deselectRow' | 'expandRow' | 'updateSort' | 'update:itemsSelected' | 'update:serverOptions' | 'updateFilter' | 'updatePageItems' | 'updateTotalItems'
29+
export type EmitsEventName = 'clickRow' | 'selectRow' | 'deselectRow' | 'expandRow' | 'updateSort' | 'update:itemsSelected' | 'update:serverOptions' | 'updateFilter' | 'updatePageItems' | 'updateTotalItems' | 'selectAll'

0 commit comments

Comments
 (0)