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
54 stars 6 forks source link

View is not updating on adding resources using `add` method with lock rows feature and grouping #9748

Closed ghulamghousdev closed 2 months ago

ghulamghousdev commented 3 months ago

Forum post

When grouping and lock rows feature are used together and adding new resources using the add method on the resourceStore, they are not being displayed on the UI.

https://github.com/user-attachments/assets/d91facad-1f7c-4a75-9ddb-efd898f9fb83

To reproduce this issue, please use the below code:

import '../_shared/shared.js'; // not required, our example styling etc.
import Scheduler from '../../lib/Scheduler/view/Scheduler.js';
import '../../lib/Scheduler/feature/LockRows.js';
import CheckColumn from '../../lib/Grid/column/CheckColumn.js';

//region Data

const
    resources = [
        { id : 'r1', name : 'Mike', fixed : true },
        { id : 'r2', name : 'Linda', fixed : true },
        { id : 'r3', name : 'Don', fixed : false  }
    ],
    events    = [
        {
            id         : 1,
            resourceId : 'r1',
            startDate  : new Date(2017, 0, 1, 10),
            endDate    : new Date(2017, 0, 1, 12),
            name       : 'Click me',
            iconCls    : 'b-fa b-fa-mouse-pointer'
        },
        {
            id         : 2,
            resourceId : 'r2',
            startDate  : new Date(2017, 0, 1, 12),
            endDate    : new Date(2017, 0, 1, 13, 30),
            name       : 'Drag me',
            iconCls    : 'b-fa b-fa-arrows-alt'
        },
        {
            id           : 3,
            resourceId   : 'r3',
            startDate    : new Date(2017, 0, 1, 14),
            duration     : 2,
            durationUnit : 'h',
            name         : 'Double click me',
            eventColor   : 'purple',
            iconCls      : 'b-fa b-fa-mouse-pointer'
        },
        {
            id         : 4,
            resourceId : 'r4',
            startDate  : new Date(2017, 0, 1, 8),
            endDate    : new Date(2017, 0, 1, 11),
            name       : 'Right click me',
            iconCls    : 'b-fa b-fa-mouse-pointer'
        },
        {
            id         : 5,
            resourceId : 'r5',
            startDate  : new Date(2017, 0, 1, 15),
            endDate    : new Date(2017, 0, 1, 17),
            name       : 'Resize me',
            iconCls    : 'b-fa b-fa-arrows-alt-h'
        },
        {
            id         : 6,
            resourceId : 'r6',
            startDate  : new Date(2017, 0, 1, 16),
            endDate    : new Date(2017, 0, 1, 19),
            name       : 'Important meeting (read-only)',
            iconCls    : 'b-fa b-fa-exclamation-triangle',
            eventColor : 'red',
            readOnly   : true
        }
    ];

//endregion

const scheduler = new Scheduler({
    appendTo   : 'container',
    resources,
    events,
    startDate  : new Date(2017, 0, 1, 6),
    endDate    : new Date(2017, 0, 1, 20),
    viewPreset : 'hourAndDay',
    features   : {
        group    : 'name',
        lockRows : 'fixed'
    },
    rowHeight        : 50,
    barMargin        : 5,
    multiEventSelect : true,
    columns          : [
        { text : 'Name', field : 'name', width : 130 },
        { text : 'Lock Row', field : 'fixed' }
    ]
});

And try adding a resource using console:

await bryntum.query('scheduler').resourceStore.addAsync([{ id : 'r6', name : 'Arnold', fixed : false  }])
matsbryntse commented 3 months ago

Test pushed to 9748-lock-rows