taitems / jQuery.Gantt

jQuery Gantt Chart
http://taitems.github.io/jQuery.Gantt/
MIT License
952 stars 304 forks source link

gantt is not a function #187

Closed sparkline-charlie closed 8 years ago

sparkline-charlie commented 8 years ago

Hi,

Hope you could assist me on my error that i encountered.

I've tried inserting the gantt code in a function

image

After running the site. It seems encountering this error

image

Hope you could help me on this.

Thanks!

usmonster commented 8 years ago

Hi @sparkline-charlie! It looks like 2 things might be happening.

First, it looks like the plugin might not be loaded at the time when your generate function is called. Are you sure about the script load order on your page? (I can't further debug without seeing your markup.)

Second, it looks like the data you want to eventually pass to the plugin might be undefined when you initialize the plugin. This is because you are getting the data in an asynchronous AJAX call, which may not be done by the time the Gantt plugin needs the data. You might want to initialize the Gantt inside your done callback, or make your .ajax call synchronous (by passing the async: false option).

Hope this helps! Closing the issue for now--I'll reopen if it turns out to be an issue with the actual plugin. Good luck!