Skip to content

Error: Invalid parameter layoutItem id passed #65

@tomvanvegchel

Description

@tomvanvegchel

I am migrating my vue 2 grid-layout to your vue 3 approach however I keep getting the following error:
Error: Invalid parameter layoutItem id passed

I decided to copy one of your examples in hopes of trying to debug this however I am getting the same exact error using this minimal example:

<GridLayout
    ref="refLayout"
    v-model:layout="testLayout"
>
    <GridItem
        v-for="item in testLayout"
        :key="item.i"
        class="test"
        :h="item.h"
        :i="item.i"
        :w="item.w"
        :x="item.x"
        :y="item.y"
        :min-h="item.minH"
        :min-w="item.minW"
    >
        <span class="text">
          {{ item.i }}
        </span>
    </GridItem>
</GridLayout>

I noticed in the vue devtools that theres always one vue-grid-placeholder added with an i of -1.
Image

Your getLayoutItem method has the following check:

if (id === undefined || id === null || id.toString().trim().length === 0 || parseInt(id.toString()) < 0) {
  throw new Error(ErrorMsg.INVALID_LAYOUT_ITEM_ID);
}

Is this causing issues? Or am I doing something wrong. I am quite lost as I've narrowed it down to this minimal example and still can't seem to solve it.

Would love to have some input on this, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions