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.03k stars 1.2k forks source link

Uncaught TypeError: Cannot set property 'widgets_in_col' of undefined #325

Closed aw3s0me closed 10 years ago

aw3s0me commented 10 years ago

I use gridster, here is my code: gridster: { deps: [ " jquery", "vendor/gridster/src/jquery.gridster.extras", "vendor/gridster/src/jquery.coords", "vendor/gridster/src/jquery.collision", "vendor/gridster/src/jquery.draggable", "vendor/gridster/src/utils" ] },

gridster = $(".gridster > ul").gridster({
  widget_margins: [mySizeDetector.blockMargin, mySizeDetector.blockMargin],
  widget_base_dimensions: [mySizeDetector.dx, mySizeDetector.dy],
  min_cols: mySizeDetector.xCount,
  min_rows: mySizeDetector.yCount,
 }).data('gridster');

blockMargin = 0 in both cases and dx=dy=50

Full error msg: Uncaught TypeError: Cannot set property 'widgets_in_col' of undefined jquery.gridster.extras.js:5 (anonymous function) jquery.gridster.extras.js:5 (anonymous function) jquery.gridster.extras.js:165

hrosenbauer commented 10 years ago

Looks like you are using the source files. The jquery.gridster.extras.js only contains the additional functions for gridster - not gridster itself. You should include the files of the dist-folder (then the jquery.gridster.with-extras.js includes the content of jquery.gridster.js too) - if your dist-folder doesn't exist, you need to generate it using grunt (see Gruntfile.js in the repo)

aw3s0me commented 10 years ago

Thank you so much. Problem has been solved.