<template>
  <ContentsWrapper>
    <template #actions>
      <button @click="onAddClick">추가</button>
      <button @click="onUpdateClick">저장</button>
    </template>
    <input type="text" />
    <ToastGrid ref="grid1Ref" :data="data" :columns="colDefs" />
  </ContentsWrapper>
</template>

<script setup lang="ts">
import { colDefs } from "../../../constants/resourceGrid";

definePageMeta({
  title: "리소스 관리",
});

const data = [{}];

const grid1Ref = ref();

onMounted(async () => {
  await nextTick(); // DOM 및 컴포넌트 렌더링 완료 대기
  grid1Ref.value?.api()?.setBodyHeight("700");
});

function onAddClick() {
  grid1Ref.value?.api()?.appendRow({});
}

function onUpdateClick() {
  //grid1Ref.value?.clearGrid();
  console.log(grid1Ref.value?.api()?.getModifiedRows());
}
</script>
