Files
bio_frontend/components/base/ToastGrid.vue

51 lines
1.3 KiB
Vue
Raw Normal View History

2025-08-14 11:00:48 +09:00
<script setup lang="ts">
import { ref, defineExpose } from 'vue';
import type { OptColumn, OptRow } from 'tui-grid/types/options';
import type { TuiGridElement } from 'vue3-tui-grid';
import type Grid from 'tui-grid';
interface TreeColumnOptions {
name: string;
useCascadingCheckbox?: boolean;
}
const tuiGridRef = ref<TuiGridElement>();
2025-08-22 14:01:30 +09:00
const selectionUnit = "row"
2025-08-14 11:00:48 +09:00
const props = defineProps<{
data: OptRow[];
// editor: https://github.com/nhn/tui.grid/blob/master/packages/toast-ui.grid/docs/v4.0-migration-guide-kor.md
columns: OptColumn[];
treeColumnOptions?: TreeColumnOptions;
rowHeaders?: string[];
rowKey?: string;
}>();
// grid api : https://nhn.github.io/tui.grid/latest/Grid
// const ref = ref<InstanceType<typeof ToastGrid>>();
// ref.value?.api()?.clear();
// ref.value?.api()?.getModifiedRows();
defineExpose({
api: (): Grid | undefined => tuiGridRef.value?.gridInstance,
clearGrid: () => clearGrid(),
});
function clearGrid() {
tuiGridRef.value?.gridInstance.clear();
}
</script>
<template>
<tui-grid
ref="tuiGridRef"
:data="props.data"
:columns="props.columns"
:treeColumnOptions="props.treeColumnOptions"
:rowHeaders="props.rowHeaders"
:rowKey="props.rowKey"
2025-08-22 14:01:30 +09:00
:selectionUnit="selectionUnit"
2025-08-14 11:00:48 +09:00
/>
</template>