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

Items overlap upon window resize

Open rawul opened this issue 6 years ago • 13 comments

Software version (please complete the following information):

  • Browser Chrome
  • Vue Version 2.6.10
  • vue-grid-layout Version:2.3.7

Describe the bug I'm having a responsive grid layout:

    :responsive="true"
    :cols="{ lg: 3, md: 2, sm: 2, xs: 1, xxs: 1 }"

If I have an item on column 3 and i resize window so that only 2 columns would fit the items overlap.

rawul avatar Nov 21 '19 11:11 rawul

same issue here, any update or solution? @rawul

vdiaza avatar Dec 09 '19 20:12 vdiaza

so do i

jiuyaolaisb avatar Dec 12 '19 08:12 jiuyaolaisb

I was able to fix it on my end. My issue was that I was using vuex and getting the array through a computed property. I simply added a set function to the property to uodated the state and that fixed it! (There is no need to update the DB)

vdiaza avatar Dec 12 '19 15:12 vdiaza

I was able to fix it on my end. My issue was that I was using vuex and getting the array through a computed property. I simply added a set function to the property to uodated the state and that fixed it! (There is no need to update the DB)

I have the same problem as you, also using vuex and computed property. But when I switch the browser mode to mobile phone, refreshing the page, the problem also appears

jisheng100 avatar Dec 13 '19 01:12 jisheng100

Screen Shot 2020-01-27 at 11 42 58 AM

Arephan avatar Jan 27 '20 16:01 Arephan

I was able to fix it on my end. My issue was that I was using vuex and getting the array through a computed property. I simply added a set function to the property to uodated the state and that fixed it! (There is no need to update the DB)

I have the same problem as you, also using vuex and computed property. But when I switch the browser mode to mobile phone, refreshing the page, the problem also appears

same with me, overlap still happens when refreshing.

Arephan avatar Jan 30 '20 19:01 Arephan

Anybody found a fix? I'm thinking about forcing to rearrange if screen size changed. But how?

oneart-dev avatar Oct 02 '20 15:10 oneart-dev

I was able to fix it on my end. My issue was that I was using vuex and getting the array through a computed property. I simply added a set function to the property to uodated the state and that fixed it! (There is no need to update the DB)

I have the same problem, how to add a set function?

Flourad avatar Oct 27 '20 12:10 Flourad

I was able to fix it on my end. My issue was that I was using vuex and getting the array through a computed property. I simply added a set function to the property to uodated the state and that fixed it! (There is no need to update the DB)

I have the same problem, how to add a set function?

Just do it like this:

computed: {
 yourComputedProperty: {
  get(){ return this.$store.getters.someProperty}
  set(value) { this.$store.commit('setProperty', value)}
}

vdiaza avatar Oct 27 '20 13:10 vdiaza

I also had this issue because I was using a Vuex getter. Once I put the setter in place I also had to ensure I had .sync set on the layout prop for GridLayout or else it wasn't trying to use my setter:

<GridLayout
      :layout.sync="dashLayout"
      :key="0"
      :cols="{ lg: 12, md: 8, sm: 8, xs: 4, xxs: 1 }"
      :row-height="10"
      :is-draggable="true"
      :is-resizable="true"
      :responsive="true"
      :margin="[10, 10]"
>

Tyler-RCSD avatar Nov 03 '20 15:11 Tyler-RCSD

Even official responsive example have this issue. @gmsa Im using Chrome Version 86.0.4240.183 (Official Build) (64-bit)

image

oneart-dev avatar Nov 09 '20 16:11 oneart-dev

That is happening because the docs are generated with vuepress, which uses ssr and causes problems.

EDIT: anyway, the layout prop was missing the .sync modifier, that fixed it in the example.

gmsa avatar Nov 09 '20 16:11 gmsa

I had a similar issue and was using vuex getter to get items from the store. In my case part of the issue was the items were not ready when grid layout is rendered. Therefore I used v-if to check items are loaded.

<grid-layout :layout.sync="widgets.layouts" :col-num="colNum" :row-height="60" :is-draggable="draggable" :is-resizable="resizable" :vertical-compact="true" :auto-size="true" :use-css-transforms="false" :cols="columns" :responsive="true" v-if="loaded">

sudeerax avatar Mar 03 '22 01:03 sudeerax