DHTMLX / gantt

GPL version of Javascript Gantt Chart
https://dhtmlx.com/docs/products/dhtmlxGantt/
GNU General Public License v2.0
1.48k stars 324 forks source link

'undefined' returned in tasksStore.$initItem #65

Closed ali-spb closed 3 years ago

ali-spb commented 3 years ago

Currently using this patch as temp solution:

function patchGantt() {
  this.$initItem = function (item) {
    var loadedItem = item;
    if (this.$config.initItem) {
      loadedItem = this.$config.initItem(loadedItem);
    }
    var existingItem = this.getItem(item.id);
    if (existingItem && existingItem.parent != loadedItem.parent) {
      // PATCH: 'move' fn do not have return statement, removing 'return' keyword, otherwise we will return 'undefined'
      // return this.move(loadedItem.id, loadedItem.$index || -1, loadedItem.parent || this._ganttConfig.root_id);
      this.move(loadedItem.id, loadedItem.$index || -1, loadedItem.parent || this._ganttConfig.root_id);
    }
    return loadedItem;
  };
}

patchGantt.apply(Gantt.$data.tasksStore);
gearcoded commented 3 years ago

@ali-spb, that was fixed in the 7.1 version: http://prnt.sc/12kvo2o