Closed bostondevin closed 3 years ago
Here are some events that may help you
<Grid {...}
on:resize="handleResize"
on:mount="handleMount"
on:change="handleChange"
on:pointerup="handlePointerUp"
/>
<script>
const handleResize = (event) => {
console.log(event.detail.cols)
console.log(event.detail.xPerPx)
console.log(event.detail.yPerPx)
console.log(event.detail.width)
}
const handleMount = (event) => {
console.log(event.detail.cols)
console.log(event.detail.xPerPx)
console.log(event.detail.yPerPx)
}
const handleChange = (event) => {
console.log(event.detail.unsafeItem) // Active item
console.log(event.detail.id) // Active item.id
console.log(event.detail.cols)
}
const handlePointerUp = (event) => {
console.log(event.detail.unsafeItem) // Active item
console.log(event.detail.id) // Active item.id
console.log(event.detail.cols)
}
</script>
on:resize | Function |
The event is triggered when the grid is resized. There are a couple of properties in the detail property. | No |
---|---|---|---|
on:change | Function |
The event is triggered when an element is resized or moved | |
on:mount | Function |
The event is triggered when the grid is mounted | |
on:pointerup | Function |
The event is fired when a pointer is no longer active |
Cool - just figured this out by digging in the code - thanks!!!
What events do I use on the Grid to find out what changed so I can save things to the database?