gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

an exception happens when I drag one widge to another(acceptWidgets :true)

Open AmandaZYJ opened this issue 9 years ago • 5 comments

Subject of the issue

i can drag widge between two placeholder,it seems fine on browser but actually an exception happens this is the exception gridstack.js:885 Uncaught TypeError: Cannot set property '_grid' of undefined at HTMLDivElement. (http://localhost/datav/base/plugins/grid/gridstack.js:885:32) at HTMLDivElement.dispatch (http://localhost/datav/base/common/js/jquery-2.1.4.js:4435:9) at HTMLDivElement.elemData.handle (http://localhost/datav/base/common/js/jquery-2.1.4.js:4121:28) at Object.trigger (http://localhost/datav/base/common/js/jquery-2.1.4.js:4350:12) at HTMLDivElement. (http://localhost/datav/base/common/js/jquery-2.1.4.js:4901:17) at Function.each (http://localhost/datav/base/common/js/jquery-2.1.4.js:374:23) at jQuery.fn.init.each (http://localhost/datav/base/common/js/jquery-2.1.4.js:139:17) at jQuery.fn.init.trigger (http://localhost/datav/base/common/js/jquery-2.1.4.js:4900:15) at t.(anonymous function).(anonymous function)._trigger (http://localhost/datav/base/plugins/datav/js/jquery-ui.min.js:6:11056) at t.(anonymous function).(anonymous function)._drop (http://localhost/datav/base/plugins/datav/js/jquery-ui.min.js:11:12603)

Your environment

  • version of gridstack.js
  • which browser and its version

Steps to reproduce

Add Widget
	        <br/>
	        <div class="grid-stack">
	    
		        <div class="grid-stack-item " data-gs-x="4" data-gs-y="0" data-gs-width="4" data-gs-height="4" >
		                <div class="grid-stack-item-content" style="background-color:lightblue;color:lightblue">

		                        <div class="grid-stack">
		                            <div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="3" data-gs-height="1"><div class="grid-stack-item-content">1</div></div>
		                            <div class="grid-stack-item" data-gs-x="3" data-gs-y="0" data-gs-width="3" data-gs-height="2"><div class="grid-stack-item-content">2</div></div>
		                            <div class="grid-stack-item" data-gs-x="6" data-gs-y="0" data-gs-width="3" data-gs-height="3"><div class="grid-stack-item-content">3</div></div>
		                            <div class="grid-stack-item" data-gs-x="9" data-gs-y="0" data-gs-width="3" data-gs-height="4"><div class="grid-stack-item-content">4</div></div>

		                        </div>

		                </div>
	            </div>
	        </div>

$(function () { var options = { cell_height: 80, verticalMargin:2, acceptWidgets: true }; $('.grid-stack').gridstack(options); });

Expected behaviour

Tell us what should happen

Actual behaviour

Tell us what happens instead

AmandaZYJ avatar Oct 19 '17 09:10 AmandaZYJ

Got this error too, anybody knows why this occurs?

cyrilis avatar Nov 29 '17 01:11 cyrilis

This is resolved in current v0.4.0.

radiolips avatar May 12 '18 15:05 radiolips

v0.4.0.

This is resolved in current v0.4.0.

I still see this issue in v0.4.0. Is there any work around for this. Uncaught TypeError: Cannot set property '_grid' of undefined at HTMLDivElement. (gridstack.js:859)

Steps:

1. I have Empty grid with acceptWidgets :true.
2. Dropping widget from jqueryUi draggable.
3. resize/ move the widget which is dropped.
4. Try to drop one more new widget.
    4.1 No places holder is shown.
    4.2 On drop the above js error comes.
![image](https://user-images.githubusercontent.com/2945439/49431995-b238e280-f7d4-11e8-8cda-0ffdd0cdda24.png)

mishrarajesh avatar Dec 04 '18 09:12 mishrarajesh

  1. I have Empty grid with acceptWidgets :true.
  2. Dropping widget from jqueryUi draggable.
  3. resize/ move the widget which is dropped.
  4. Try to drop one more new widget. 4.1 No places holder is shown. 4.2 On drop the above js error comes.

I have the same issue, even with the newest version (v0.5.5)

jploch avatar Dec 02 '19 15:12 jploch

I'm pretty sure I ran into this ("fixed error when dragging add item over the trash, and then over second grid" commit msg) and fixed the assert it as part of #1096 please use latest 0.5.5-dev code and let me know - in the next release.

adumesny avatar Dec 21 '19 17:12 adumesny