ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.04k stars 1.2k forks source link

gridstack Uncaught TypeError: Cannot set property '_id' of undefined #589

Open chakravarthyecanarys opened 7 years ago

chakravarthyecanarys commented 7 years ago

Hello, I getting this error - gridstack.js:377 Uncaught TypeError: Cannot set property '_id' of undefined

my JSON is as follows

[ { "x": 1, "y": 0, "id": "4", "nid": 14, "width": 5, "height": 3 }, { "x": 4, "y": 6, "id": "8", "nid": 15, "width": 8, "height": 3 } ]

and code is as follows -

var grid = jQuery('.grid-stack').data('gridstack');

grid.addWidget(jQuery('

'), sobj.x , sobj.y, sobj.width, sobj.height,false);
jQuery(".grid-stack-item").attr("id",sobj.nid);

jQuery(document).on( "click", ".grid-stack-item", function() { //jQuery(this).addClass("activ"); var gridster = jQuery('.grid-stack').data('gridstack'); console.log(gridster); gridster.removeWidget( jQuery(this).parent()); });

I wan to remove widget when click on swclose or atleast on widgte . so Please help in this . Thank you .

2Owy commented 6 years ago

Lol :)) This is gridster not gridstack :)