Skip to content

[React] Item Content is missing on Drag and Drop items #2976

Closed

Description

@chungwong

Item Content is missing on Drag and Drop items

I asked the question on Slack and I was wising it will be fixed on the new React codebase. However, it still presents in the new code.

Your environment

  • tested on commit 16f3fec but it happens on the release before v11.4.0 too
  • Version 129.0.6668.70 (Official Build) (64-bit)

Steps to reproduce

cd gridstack.js/react

# apply the diff provided below to `src/demo/demo.tsx`

npm run dev
diff --git a/react/src/demo/demo.tsx b/react/src/demo/demo.tsx
index 2e1499b5..5071091c 100644
--- a/react/src/demo/demo.tsx
+++ b/react/src/demo/demo.tsx
@@ -1,5 +1,5 @@
 import { ComponentProps, useEffect, useState } from "react";
-import { GridStackOptions, GridStackWidget } from "gridstack";
+import { GridStackOptions, GridStack, GridStackWidget } from "gridstack";
 import {
   ComponentDataType,
   ComponentMap,
@@ -136,8 +136,17 @@ export function GridStackDemo() {
   // ! Uncontrolled
   const [initialOptions] = useState(gridOptions);
 
+  useEffect(() => {
+    // setup drag drop behavior
+    let sidebarContent = [
+      { w:2, h:2, subGridOpts: { children: [{content: 'nest 1'}, {content: 'nest 2'}]}}
+    ];
+    GridStack.setupDragIn('.sidebar-item', undefined, sidebarContent);
+  }, []);
+
   return (
     <GridStackProvider initialOptions={initialOptions}>
+      <div className="sidebar-item grid-stack-item">Drag nested</div>
       <Toolbar />
 
       <GridStackRenderProvider>

Expected behavior

The item content shouldn't be missing.

Activity

  1. Aysnine commented on Mar 4, 2025

    @Aysnine
    Contributor

    An experimental component here: https://github.com/Aysnine/gridstack-react/blob/main/src/examples/004-drag-in/index.tsx

    New new react wrapper design on the way.

  2. AO19 commented on Jun 23, 2025

    @AO19

    An experimental component here: https://github.com/Aysnine/gridstack-react/blob/main/src/examples/004-drag-in/index.tsx

    New new react wrapper design on the way.

    How are you getting along? Need any help?

  3. Codefox11 commented on Aug 1, 2025

    @Codefox11

    An experimental component here: https://github.com/Aysnine/gridstack-react/blob/main/src/examples/004-drag-in/index.tsx

    New new react wrapper design on the way.

    An experimental component here: https://github.com/Aysnine/gridstack-react/blob/main/src/examples/004-drag-in/index.tsx

    New new react wrapper design on the way.

    it's very nice wrapper :)

  4. Codefox11 commented on Aug 2, 2025

    @Codefox11

    @Aysnine I've one question. when drag element from toolbar, I'd like to use addWidget() after do some actions like calling API and get id for widget etc. how can I do it?

  5. added a commit that references this issue on Sep 21, 2026
    acc5386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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