I need the static_background to set to true as I noticed that with a few hundred tasks and the scale resolution is set to minute, the rendering is very lag and slow, especially on slower computers.
However, with that in place, I am not able to see the selected row in Chart area.
Yes, selected row isn’t highlighted because in case when you set static_background to true, cells are not rendered as html elements in the timeline area. As a workaround you can draw new row element using the addTaskLayer() method over the background image to show the selected row. So, to solve the issue you need to add the code below:
If you decide to add vertical markers and highlight certain dates in your app, you would encounter the same issue. If that happens please find the solution and the demo in the comment here.
I supposed I can also do a check for scale is minute then I set static_background = true otherwise, I should be fine with day scale. Would that work? Anything to take note of?
What exactly does this do? I’m using React so does that make any difference to use the code you shown?
Can I place the IIFE (you written) on the onMount lifecycle?
Which comment are you referring to? I don’t see any comments.
I supposed I can also do a check for scale is minute then I set static_background = true otherwise, I should be fine with day scale. Would that work? Anything to take note of?
If you do not want to add the code for the additional layer, you can enable the static background for the minute scale only. However, please note, that if you increase the displayed date range, Gantt will have to draw more cells (and div elements) so it will affect the performance. In other words, the performance issue is related to the number of cells, so you need to apply the performance tweaks depending on that.
What exactly does this do? I’m using React so does that make any difference to use the code you shown?
That code makes sure that Gantt is loaded and applies the additional layer code. Also, it runs the enableRowHighlight function for the Pro and for the Standard versions. I think it is an example of how to make a function work for both versions. However, the static_background and the addTaskLayer features don’t work in the Standard version, so it might be just an example.
Can I place the IIFE (you written) on the onMount lifecycle?
I don’t specialize in React so I cannot explain how it should work, but I tried to apply it in a react project and found that it is necessary to change Gantt.plugin(enableRowHighlight) to window.Gantt.plugin(enableRowHighlight). Otherwise, it throws an error (probably, because the Gantt object is created but Gantt is not fully loaded).