Post by cydef »

Hello,

We are currently using the Bryntum Gantt on version 1.3.7 (planning to update to the 2.0 soon).
I would like to know if it's possible to customize the project header.
Image

I saw we could customize the columns displayed for each task with the "columns" key.
Here is our current Gantt configurator object :

         {
                project: {
                    "calendar": "general",
                    "daysPerWeek": 5,
                    "daysPerMonth": 20
                },
                columns:
                [
                    {type: "wbs", id: 'br_column_1'},
                    {type: "name", width: 250, id: 'br_column_2'},
                    {type: "startdate", id: 'br_column_3'},
                    {type: "enddate", id: 'br_column_3_1'},
                    {type: "duration", id: 'br_column_4_1'},
                    {type: "resourceassignment", width: 120, showAvatars: false, id: 'br_column_5'},
                    {type: "percentdone", showCircle: true, width: 70, id: 'br_column_6'},
                    {type: "predecessor", width: 112, id: 'br_column_7'},
                    {type: "successor", width: 112, id: 'br_column_8'},
                    {type: "schedulingmodecolumn", id: 'br_column_9'},
                    {type: "calendar", id: 'br_column_10'},
                    {type: "constrainttype", id: 'br_column_11'},
                    {type: "constraintdate", id: 'br_column_12'},
                    {type: "addnew", id: 'br_column_13'}
                ],
                weekStartDay: 1,
            }

Is there a way to customize the header too ? I could not find it in the documentation, but maybe I missed something.
We would like to display the PROJECT END next to the PROJECT START field on the header.

Thank you


Post by Terence »

It is possible to change labels in the toolbar and add new controls with a tbar config in the configurator object. But in this case there are listeners attached setting the dates and it is not easily possible to set the position of the control.

I could add it for you in one of the upcoming releases and set is hidden by default. Then you can make it visible with the tbar config.


Post by cydef »

Hello,

This would be gladly appreciated.

We would only want those two fields (startDate and stopDate) to be readonly, because we find it a bit dangerous that dates are updated for all selected projects as soon as we set a value in there. So we would just like to display the start date and stop date of the first selected project, without the user being able to update it from here.

You said we could change the label of the buttons in the toolbar in the config object, can we also change other attributes (readonly for example) ? Something like :

tbar : {
    items : {
        startDateField : {readonly: true},  // keep the existing field, but set it readonly
        endDateButton : {???}  // add a new field in the toolbar to display the endDate
    }
}

I struggle a bit to find in the documentation ( https://bryntum.com/products/gantt/docs/api/Core/widget/Toolbar ?) what we can do with this Odoo configuration object.

Thank you, and have a nice day.


Post by Terence »

The toolbar is custom configured (implemented) for this Odoo module. Like all the items it contains. With the tbar object you can assign some properties you can find in the documentation. The implementation of the Odoo toolbar is not documented because it should be changed, only small modifications.

{
  tbar: {
    onPaint: ({source}) => {
        source.widgetMap.startDateField.readOnly = true;
        source.widgetMap.startDateField.label = 'Your label'
	}
 }
}

For example you can add a listener in the configuration object and modify the element you find in the widgetMap. The code above will set the startDateField to readOnly.


Post by cydef »

The readOnly attribute did not work for startDateField, but with the attribute disable, it works correctly.

source.widgetMap.startDateField.disabled = true;

Thank you for your fast answers, and looking for the endDateField on a next upgrade ;)


Post by Terence »

Good to hear, but strange that readOnly doesn't work. Works for me with the latest version.


Post Reply