Our state of the art Gantt chart


Post by beotech »

Hi, I get this warning in console :

CheckColumn is configured with a field, but this is not part of your Model fields collection.

Here is the definition of the column :

  private buildFreeHourColumn(): any {
    return {
      id: GanttColumns.COLUMN_FREE_HOUR,
      field: 'freeHour',
      type: 'check',
      text: 'Heure libre'
    };
  }

And here is the definition of custom TaskModel :

export default class BeoTaskModel extends TaskModel {
static get fields() {
    return [
    { name: 'freeHour', type: 'boolean' }
    ];
  }
}

What should I do to make this warning disappear ?


Post by ghulam.ghous »

Have you added the BeoTaskModel class to the project model. I see only these warnings, when my project config does not have the task model class.

Just add this in your config:

    project           : {
        taskModelClass : BeoTaskModel,
    }

https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#config-taskModelClass

Hope this helps!


Post by beotech »

Yes I have added the taskModelClass already.

We have other columns with custom fields, but the warning is displayed only for the 3 CheckColumns.


Post by ghulam.ghous »

Then this shouldn't be the case. I have tried this in our online example using the below code here https://bryntum.com/products/gantt/examples/basic/:

import { Gantt, StringHelper, TaskModel } from '../../build/gantt.module.js?479837';
import shared from '../_shared/shared.module.js?479837';

class BeoTaskModel extends TaskModel {
static get fields() {
    return [
    { name: 'freeHour', type: 'boolean' }
    ];
  }
}
new Gantt({
    appendTo          : 'container',
    dependencyIdField : 'sequenceNumber',
    rowHeight         : 45,
    tickSize          : 45,
    barMargin         : 8,
    project           : {
        taskModelClass : BeoTaskModel,
        autoSetConstraints : true, // automatically introduce `startnoearlier` constraint if tasks do not use constraints, dependencies, or manuallyScheduled
        autoLoad           : true,
        transport          : {
            load : {
                url : '../_datasets/launch-saas.json'
            }
        }
    },

    

    columns : [
        {
      field: 'freeHour',
      type: 'check',
      text: 'Heure libre'
    },
        { type : 'name', width : 250 }
    ],

    // Custom task content, display task name on child tasks
    taskRenderer({ taskRecord }) {
        if (taskRecord.isLeaf && !taskRecord.isMilestone) {
            return StringHelper.encodeHtml(taskRecord.name);
        }
    }
});

I will have to take a look at your code. Can you please share a simple runnable test case with us so we can debug it and see what is the problem?


Post by beotech »

Hi, I just tested on your example and I can see the warning in the logs (cf screenshot).

checkcolumn.PNG
checkcolumn.PNG (134.29 KiB) Viewed 82 times

Post by ghulam.ghous »

Hello,

Declaring the TaskModel class not gonna do anything unless you set it on the project config. See the below clip and screenshot:

Screenshot 2024-10-11 at 1.29.08 AM.png
Screenshot 2024-10-11 at 1.29.08 AM.png (513.89 KiB) Viewed 66 times
Screen Recording 2024-10-11 at 1.28.18 AM.mov
(17.69 MiB) Downloaded 3 times

Post by beotech »

Hello, you are right. Sorry I forgot this little piece of code.


Post Reply