Premium support for our pure JavaScript UI components
Hey, I'm looking at trying to customise the timeline headers based on data that we calculate on the fly as the date range changes. I'm using the visibleDateRangeChange event for calculating the data which is working fine, but when I define a header renderer function in a viewPreset it runs once for each cell in the full range at the start and seemingly caches the contents & config for use later. This doesn't work for us, as the data we need doesn't exist at that point. I've tried using renderContents(), refreshHeaders etc. on the Gantt view but they don't seem to affect the timeline panel.
Is there any other function I can use to either render the header contents as they scroll into view, or force a re-render of those headers when the data changes?
Thanks!
HI,
Please share more info - why do you need to force header refresh? What data did you render into the header? Are you about zooming to required level after data load or something else? How header is related to data loaded on timeline?
Hi Alex, I need to force a refresh because otherwise the header renderer is called too early, before the data we need is calculated. The data itself isn't that important (it's all custom stuff we've added), but the key thing here is when we calculate it.
Right now the flow is something like Data Loads > Time Range Headers Render > Gantt is Ready. As the user scrolls along the time range, the actual header DOM elements are recycled but they don't call the render functions again. I'm assuming this data is cached somewhere.
For our use-case though, we need to lazy-calculate some per-day data based on tasks, resources etc. We're doing this as the given days scroll into view and then storing the results in a custom Store. What we want is to reflect this data in the time range headers, but they've all been "rendered" long before any of this data is calculated.
Hope that helps
Cheers Mats, I hadn't appreciated that the time axis column wouldn't be included in refreshHeaders() on the Gantt view.
Hey rclarke,
Glad that's all working now! If you need any further assistance please don't hesitate to contact us here.