How to get up-to-date column data?

I want to create functionality for remembering column widths in localStorage

When I move a column, I use the onColumnResizeEnd method in which, in addition to the current column, I want to get the current width data of the remaining visible columns, but I get the previous width values

I also used gantt.getGridColumn(‘name’) and gantt.config.columns the result is the same

If you add setTimeout with a delay of 0 the values ​​will be correct but I don’t like this solution

  const handleColumnResizeEnd = () => {
    const storedColumnsWidth = getPreferencesItemByKey(projectId, StorageKey.ColumnsWidth)

    setTimeout(() => {
      if (storedColumnsWidth) {
        gantt.getGridColumns().forEach(item => {
          storedColumnsWidth[item.name] = item.width
        })
        storePreferences(projectId, StorageKey.ColumnsWidth, storedColumnsWidth)
      }
    }, 0)
  }

Hello Viktor,
The onColumnResizeEnd event fires after you finished resizing the column, but before the changes are applied. So, it is expected that you don’t get the column sizes immediately.

You can use the onColumnResizeEnd event with the onGanttRender event:
https://docs.dhtmlx.com/gantt/api__gantt_onganttrender_event.html

After a column is resized, you can enable a custom variable and check the column sizes.

Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/r443j2se