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.

Michael Easter
24.6k9 gold badges81 silver badges111 bronze badges
asked Dec 8, 2011 at 19:42

1 Answer 1

1

Why don't you use arrays?

forloop{
 tasks[taskID] = MainGanttTask(taskID...)
}
forloop{
 tasks[taskID].addChild(childTaskID...)
}
answered Dec 8, 2011 at 19:44
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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.