Our state of the art Gantt chart


Post by shimnx »

I added a new FinishColumn in the format Date, but when I clicked on the cell, the date displayed in the date control didn't match the actual date

/*
 * @Description:
 * @Version: 2.0
 * @Autor: shimnx
 * @Date: 2022-05-18 18:17:27
 * @LastEditors: shimnx
 * @LastEditTime: 2022-12-08 10:30:20
 */
/**
 * Status Column implementation file
 */

// Bryntum umd lite bundle comes without polyfills to support Angular's zone.js
import { Column, ColumnStore } from '@bryntum/gantt/gantt.lite.umd.js';
import { DateHelper } from '@bryntum/gantt/gantt.lite.umd.js';
/**
 * @module FinishColumn
 */

/**
 * A column showing the status of a task
 *
 * @extends Gantt/column/Column
 * @classType FinishColumn
 */
export default class FinishColumn extends Column {

    static get $name() {
        return 'FinishColumn';
    }

    static get type() {
        return 'finishcolumn';
    }

    static get isGanttColumn() {
        return true;
    }

    static get defaults() {
        return {
            // Set your default instance config properties here
            field      : 'finish',
            text       : 'Finish Date',
            editor     : {
                type : 'date',

    },
    htmlEncode : false,

};
    }

//endregion

renderer({ record }) {
    const finish = DateHelper.format(new Date(record.finish), 'MMM DD, YYYY');
    console.log(finish)
    return finish ? {
        tag       : 'i',
        className : `b-fa ${finish}`,
        html      : finish
    } : '';
}

}

ColumnStore.registerColumnType(FinishColumn);
Attachments
媒体5.mp4
(839.94 KiB) Downloaded 37 times

Post by alex.l »

Maybe the problem in data type. First of all, try to extends from https://bryntum.com/products/gantt/docs/api/Grid/column/DateColumn
If it won't help, please attach a runnable code with data model and JSON example, we will check what's wrong.

All the best,
Alex


Post Reply