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

Undo Redo not working when adding store instance to project #9158

Closed taauntik closed 4 months ago

taauntik commented 4 months ago

Forum post

Reproducible here https://bryntum.com/products/schedulerpro/examples/constraints/ With this code

import { SchedulerPro, DateHelper, StringHelper, EventStore, ResourceStore } from '../../build/schedulerpro.module.js?476097';
import shared from '../_shared/shared.module.js?476097';

const eventStore = new EventStore({
    data : [
        { id : 1, startDate : '2020-06-01', duration : 3, durationUnit : 'd', name : 'Event 1' },
        { id : 2, startDate : '2020-06-01', duration : 4, durationUnit : 'd', name : 'Event 2' }
    ]
});

const resourceStore = new ResourceStore({
    data : [
        { id : 1, name : 'Mike' },
        { id : 2, name : 'Dan' }
    ]
});
new SchedulerPro({
    project : {
        stm : {
            autoRecord : true
        },
        eventStore,
        resourceStore,
        assignmentStore : {
            data : [
                { event : 1, resource : 1 },
                { event : 2, resource : 2 }
            ]
        }
    },

    autoHeight : true,
    rowHeight  : 50,
    appendTo   : 'container',
    // eventStore,
    // resourceStore,

    columns : [
        { type : 'resourceInfo', text : 'Worker', field : 'name', width : 160 }
    ],
    startDate         : new Date(2020, 5, 1),
    endDate           : new Date(2020, 5, 14),

    tbar : [
        {
            type : 'undoredo'
        }
    ]
});

GIF msedge_gxxujiwS2U

taauntik commented 4 months ago

This needs enabling stm

await scheduler.project.commitAsync()

scheduler.project.stm.enable()