bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

`weekDateAndMonth` preset looks different when after zoom out and in #9846

Open taauntik opened 1 month ago

taauntik commented 1 month ago

Forum post

Reproducible with any scheduler demo, just assign viewpreset to weekDateAndMonth


I noticed that the preset 'weekDateAndMonth' looks different after I zoom out and back in.

Initial load: 2024--08-17-01-initial-load.png

Zoom out once: 2024--08-17-02-zoomed-out-one-level.png

Zoom back in: 2024--08-17-03-zoomed-into-original-level.png

I really like how it looks after zooming out and back in and would like that to be how it looks when initially loaded.

Source:

import { BryntumResourceHistogram } from '@bryntum/gantt-react';
import { useMemo, useRef } from "react";
import "./GanttStyles.scss";
import { ProjectModelConfig } from '@bryntum/schedulerpro';
import { DateHelper } from '@bryntum/gantt';

export default function App() {
    const histogramRef = useRef<BryntumResourceHistogram>(null);
    const { histogramProject } = useMemo(() => getConfigurationData(), []);
    const histogramConfig = {
        viewPreset: 'weekDateAndMonth',
        columns: [
            { type: 'resourceInfo', field: 'name', text: 'Resource', showEventCount: false, width: 250 },
            { type   : 'scale', hidden : true },
        ],
    };
    return (
        <>
            <h1>Bryntum Scheduler Pro Demo</h1>
            <div style={{ flex: 1 }}>
                <BryntumResourceHistogram ref={histogramRef} {...histogramConfig} project={histogramProject} />
            </div>
        </>
    );
}

function getConfigurationData() {
    const resourceProject = {
        calendar: 'general',
        autoSetConstraints : true,
        autoLoad: true,
        validateResponse: true,
    };
    const histogramProject = Object.assign({}, resourceProject, {
        transport: {
            load: {
                url: '/resource-gantt.json',
            },
        },
        maxCalendarRange: DateHelper.asMilliseconds(10, 'years'),
        calendar: 'general',
        calendars: [
            {
                id: "general",
                name: "General"
            }
        ],
        onBeforeResponseApply: () => { },
    } satisfies ProjectModelConfig);
    return { histogramProject };
}