Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can't set an id to a widget through setupDragIn #2231

Closed
@fredericrous

Description

@fredericrous

Subject of the issue

I rely deeply on grid stack IDs (gs-id), I need a way to track the widgets

Your environment

  • gridstack version: v7.2.3

Steps to reproduce

Here is my helper function:

 GridStack.setupDragIn('.gridstack-add-widget', {
      appendTo: '.gridstack-widget-dragged',
      helper: function (event: Partial<DragEvent>) {
        const id = nanoid();
        // ...
        // some code to store metadata of a widget based on its id
        // ...
        const target = event.target as GridItemHTMLElement;
        const clone = Utils.cloneNode(target.parentElement!);
        clone.setAttribute('gs-id', id);
        return clone;
      },
    });

Expected behavior

I expect to set an id with GridStack.setupDragIn function

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions