[Gantt error] Uncaught RangeError: Maximum call stack size exceeded


#1

Hello, I have a enterprise license to use Gantt and i have problems while using it. When i’m navigating in Grid, quickly open/editing (inline) dates from the same task, the Library throws an error of Maximum Call Stack Size Exceeded.
Our code could be find here: https://snippet.dhtmlx.com/5/ea461eeb9


snippet.dhtmlx.com-1641592371701.log (14.2 KB)
https://youtu.be/mZfEF5zAESU


#2

Hello Marcio,
That issue occurs because you return true in the is_changed function. Because of that, the onBeforeSave event fires each time the task is updated, and it creates an unending loop. You need to return true only if the value is really changed.
For the duration_ editor:

  is_changed: function (value, id, column, node) {
    var input = this.get_input(node);
    var actual_value = parseInt(input.value.match(/\d+/)[0]) * 8
    return actual_value !== value;
  },

For the boolean editor:

  is_changed: function (value, id, column, node) {
    return !!this.get_input(node).checked !== !value;
  },

Here is the updated snippet:
http://snippet.dhtmlx.com/5/80435d639


#3

Thanks for the help Ramil.
When i am using the end date, i has the same problem occuring between the start and end dates columns. For my custom dates columns, the problem is occuring too. Can you help me again ? I change the columns that were hide ‘true’ to ‘false’.
http://snippet.dhtmlx.com/5/b0fc82284


#4

Hello Marcio,
The issue with the end_date inline editor occurs because you modify the values in the onBeforeSave event handler. And you do that to make the date look inclusive. It is not recommended to modify the dates as it may not work correctly with auto-scheduling or some other Gantt features.
It is better to create a custom inline editor to modify the end_date parameter. By using it, you can change the displayed and entered date without actually changing the value in the HTML element.
Here is a simple example with inclusive dates:
https://snippet.dhtmlx.com/5/2fc90812a

As you use the hour duration unit, you don’t even need to modify the dates.
You can use custom date editors and modify the dates only after the inline editor is closed.
Here is an example with the date input type:
http://snippet.dhtmlx.com/5/1b2d12c95
Here we need to modify the dates because the input element with the date type doesn’t have the hour values.

Here is another example with the datetime-local input type:
http://snippet.dhtmlx.com/5/c4f4b19aa
The input element may take more space, but it will store the dates more accurately.

Here is the snippet with your configuration and the datetime-local input type:
http://snippet.dhtmlx.com/5/60bcdff2b

By the way, you can use the formatters to display and modify the duration in the human-readable format:
https://docs.dhtmlx.com/gantt/desktop__formatters_ext.html#durationformatter