Skip to content

Commit

Permalink
Clear the data table's selected rows on send.
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Aug 16, 2024
1 parent fc900c2 commit 69a2753
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/components/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ interface Props {
const props = defineProps<Props>();
const {
dataList, dataKey, columns, dataName, allowMultiSelect, loading,
dataList, dataKey, columns, dataName, allowMultiSelect, loading
} = toRefs(props);
const { t } = useI18n();
Expand All @@ -146,6 +146,14 @@ const columnSpan = computed(() => (columns.value.length + (allowMultiSelect.valu
const selectedRows = ref<TableDataRow[]>([]);
const mutableDataList = ref<TableDataRow[]>(null);
const clearSelectedRows = () => {
selectedRows.value = [];
}
defineExpose({
clearSelectedRows,
});
/**
* Returns either a filtered data list, or the original all nice and paginated
*/
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/views/admin/WaitingListPanelView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const loading = ref(true);
const pageError = ref('');
const pageNotification = ref('');
const selectedFields = ref([]);
const dataTableRef = ref(null);
const filteredUsers = computed(() => waitingListUsers.value.map((user) => ({
id: {
Expand Down Expand Up @@ -216,6 +217,7 @@ const sendInvites = async () => {
// Unselect everything!
selectedFields.value = [];
dataTableRef.value.clearSelectedRows();
await refresh();
loading.value = false;
Expand Down Expand Up @@ -254,6 +256,7 @@ onMounted(async () => {
<admin-nav/>
<div v-if="displayPage">
<data-table
ref="dataTableRef"
data-name="Waiting List Users"
data-key="id"
:allow-multi-select="true"
Expand Down

0 comments on commit 69a2753

Please sign in to comment.