0

I am working on generating gantt chart using jquery. Have searched alot, but didn't reach any conclusion on if it is possible to declare a dynamic jquery variable. Here is a sample of what I am trying to do:

First, I am trying to generate a dynamic main task from the database. I want to make the variable name dynamic so that i can dynamically assign it subtasks. want to do somthing like:

forloop{
var task+taskID = MainGanttTask(taskID...)
}

forloop{
task+taskID.addChild(childTaskID...)
}

So, is there any way to get my "task+taskID" variable working?

Thanx in advance.

1 Answer 1

1

Why don't you use arrays?

forloop{
    tasks[taskID] = MainGanttTask(taskID...)
}

forloop{
    tasks[taskID].addChild(childTaskID...)
}
Sign up to request clarification or add additional context in comments.

5 Comments

thanx for your reply, but the jquery plugin that i am using, doesn't accept array, needs the input for the task name to be a variable.
What is that plugin? If we know maybe we can help you more.
not really a plugin. a class which i customized, got it from dhtmlx.com/docs/products/dhtmlxChart/index.shtml
solved. just needed to declare the array before using it. thanx
Please accept my answer if it was helpful. You can learn from here about accepting answers. Read the FAQ for more info! Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.