xuanngo2001 / jsgantt

Automatically exported from code.google.com/p/jsgantt
0 stars 0 forks source link

g.getDateInputFormat is not a function #91

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
it shows that g is no defined

Original issue reported on code.google.com by silphyel...@gmail.com on 20 Oct 2010 at 9:15

GoogleCodeExporter commented 8 years ago
I have the same issue, but cannot find where g is used. It should be a 
reference to the JSGantt.GanttChart object which has the getDateInputFormat 
function. Don't have a clue though how to get the reference to this object.

Original comment by Paul.Fen...@gmail.com on 6 Jul 2011 at 3:29

GoogleCodeExporter commented 8 years ago
any solution? or idea 

Original comment by msm2...@gmail.com on 8 Jan 2014 at 9:33

GoogleCodeExporter commented 8 years ago
This message is occurring with me also, does anyone know how to fix this?

Original comment by gianlucc...@gmail.com on 10 Nov 2014 at 4:49

GoogleCodeExporter commented 8 years ago

This issue is duplicated as Issue 125, my explanation there was quite brief so 
I'll give a more complete description of the problem here.

In both the documentation and the sample index file supplied by the jsgantt 
project the chart is instantiated with a command that stores the resulting 
gantt chart in a javascript variable "g" (line 93 in index.htm) i.e.

  var g = new JSGantt.GanttChart('g',document.getElementById('GanttChartDIV'), 'day');

Unfortunately there are multiple instances in the code where an assumption is 
made that the gantt chart object will always be stored in a variable named "g" 
(specifically lines 74, 75, 510, 512, 860, 877, 879, 923, 941, 943, 958, 970, 
and 972).  This means that if you use a different variable to store your gantt 
chart it just won't work i.e. if you instantiate the chart like this

  var myMeaningfulVariableName = new JSGantt.GanttChart('myMeaningfulVariableName',document.getElementById('GanttChartDIV'), 'day');

it will throw errors.

There are two work arounds.
1) always use a variable named "g" for your chart.
2) after instantiating the chart create a variable called "g" and set it to the 
variable name you used e.g.

  var myMeaningfulVariableName = new JSGantt.GanttChart('myMeaningfulVariableName',document.getElementById('GanttChartDIV'), 'day');
  var g = myMeaningfulVariableName;

Shameless plug: I've fixed this in my fork of jsgantt ( 
https://code.google.com/p/jsgantt-improved ) along with a lot of the other 
issues listed here.

Original comment by jsgantt.improved on 11 Dec 2014 at 8:31