vue-grid-layout icon indicating copy to clipboard operation
vue-grid-layout copied to clipboard

when I delete one item, the grid-item would not be rearranged

Open ShirlyKong opened this issue 7 years ago • 5 comments

I have a dashboard use your plugin, each time I delete one item, the grid-item would not be rearranged, and the method layout-updated would not be triggered? What should I do? (Thanks for help)

ShirlyKong avatar May 11 '18 09:05 ShirlyKong

Have you set the vertical-compact prop? I think it will help.

chenenpei avatar May 11 '18 14:05 chenenpei

@chenenpei thank you for your advice,now grid-item would be rearranged. the problem is that when I delete item , layout-updated event would not be triggered, however , I need save item position to database, look forward solutions, thanks

ShirlyKong avatar May 12 '18 04:05 ShirlyKong

There isn't a default deletion event provided for grid-item, so I assume you implemented one by yourself. My suggestion is printing out the grid-layout component after deletion, then you may find what you need there. The codes below may give you a hint.

<grid-item @click.native="onRemove(item)"/>
watch: {
    layout() {
         console.log(this.$refs('layout');
    },
},
methods: {
    onRemove(val) {
        this.layout = this.layout.filter(item => item.i !== val.i);
    }
}

chenenpei avatar May 15 '18 04:05 chenenpei

The data has changed, but the item arrangement has not been updated

wp993080086 avatar Dec 06 '22 09:12 wp993080086

Any news on this? I'm having the same issue.

pdrivom avatar Jan 11 '23 16:01 pdrivom