In docs.dhtmlx.com/gantt/desktop__ … lates.html,
is there a way to place a ‘gantt.templates.grid_open’ ( or custom icon) button on the ‘gantt.templates.grid_indent’ space of a particular task.
I want to use this button as a toggle for collapsing similar tasks to this task or not.
Hello Sun,
Yes, it is possible to do that. You just return the div element with the onclick function defined. In the function you process each task and compare task levels to determine if the task should be collapsed or not.
In the following example you can click on the gray plus button near tasks #2, #3 and #7 and the task #4 will be collapsed or expanded. snippet.dhtmlx.com/2777e5e63
These articles may be useful for you: docs.dhtmlx.com/gantt/api__gantt_eachtask.html docs.dhtmlx.com/gantt/api__gant … plate.html
I have 2 questions for you.
In collapse("+item.$level+") in your code, what does “+” on both side of item.$level do? I have never seen this kind of coding before…
Could you shed some light?
2nd question is more about getting an advice from you, if you have any.
Let’s say I want to display “+” icon on Task#5 ( not on Task #2, #3, #4, #6, #7) so that I can collapse Task #6 only ( Note: at its SAME level only for its own type)
Any suggestion?
Usually if there is a function we can return a variable that contains some value. Also, it can be number, string, array or object.
In this case we return the string. And “+” means that we concatenate the string. Please read this article and find concat() method: w3schools.com/js/js_string_methods.asp
Yes, it is possible to do that. And looks like in my previous examples I used it in a different way, not the way it was described: docs.dhtmlx.com/gantt/desktop__ … ninabranch
Here is the snippet with the example that is closer to what is written about it in the docs: snippet.dhtmlx.com/0347bab3f