How does the setDataAt method work? #616
MattTheCuber
started this conversation in
General
Replies: 1 comment 2 replies
-
Hello @MattTheCuber , this method is mainly used for cell redraw, so if you want to redraw single cell you can do something like this: https://codesandbox.io/p/sandbox/rg-setdataat-vue-3-composition-api-rmxf88 <template>
<button @click="setDataAt">Set A:1 = 5</button>
<br /><br />
<VGrid ref="grid" :columns="columns" :source="rows" />
</template>
<script setup>
import { ref, shallowRef } from "vue";
import VGrid from "@revolist/vue3-datagrid";
const grid = ref(null);
const columns = ref([
{ prop: "name", name: "A" },
{ prop: "details", name: "B" },
]);
// shallowRef to avoid deep change
const rows = shallowRef([
{
name: "1",
details: "Item 1",
},
]);
const setDataAt = () => {
rows.value[0].name = 5;
// redraw cell
grid.value.$el.setDataAt({
row: 0,
col: 0,
rowType: "rgRow",
colType: "rgCol",
});
};
</script>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was having trouble interpreting the documentation. Here is my best guess:
Beta Was this translation helpful? Give feedback.
All reactions