Our pure JavaScript Scheduler component


Post by Alan »

I'm having trouble getting the CrudManager to work with an AssignmentStore. Starting from the PHP CrudManager demo, https://www.bryntum.com/examples/scheduler/crudmanager/, I add an assignmentStore to the CrudManager because I want to assign multiple resources to events:
assignmentStore : { // enables assignment of multiple resources to events
    id:'assignments' // without this, 'stores' parameter to php excludes 'assignments', not sure if this is needed or not
},
when I add "assignments" to the data file and remove the resourceId from the events, no events are displayed on the scheduler, e.g,:
...
],
'assignments' => [
    'rows' => [
        [ 'id' => 1, 'resourceId' => 1, 'eventId' => 1 ],
        [ 'id' => 2, 'resourceId' => 2, 'eventId' => 1 ]
    ]
]
i tried without the 'rows' wrapper within 'assignments' too. Adding the resourceId back to the events makes the events show up, but there are no multiple assignments. I could not find any documentation on how to get this to work.

I have attached my updated files for the demo so you can see what I have done. What am I doing wrong?

Thank you!
Attachments
read.zip
(590 Bytes) Downloaded 96 times
app.module.js
(2.96 KiB) Downloaded 92 times
Last edited by Alan on Mon Feb 03, 2020 3:58 pm, edited 1 time in total.

Post by mats »

Try this definition while we look into this:
crudManager : {
        autoLoad  : true,
        assignmentStore : {
            storeId    : 'assignments'
        },

Post by mats »

Ticket opened here to investigate: https://github.com/bryntum/support/issues/232

Post by mats »

You can find the proper configuration for using Assignments with CrudManager here. https://www.bryntum.com/examples/scheduler/multiassign-with-dependencies/
/* eslint-disable no-unused-vars */
import '../_shared/shared.js'; // not required, our example styling etc.
import Scheduler from '../../lib/Scheduler/view/Scheduler.js';
import AssignmentStore from '../../lib/Scheduler/data/AssignmentStore.js';
import '../../lib/Scheduler/column/ResourceInfoColumn.js';
import '../../lib/Grid/feature/Stripe.js';
import '../../lib/Scheduler/feature/Dependencies.js';

const assignmentStore = new AssignmentStore({
    id : 'assignments'
});

let scheduler = new Scheduler({
    adopt     : 'container',
    minHeight : '20em',

    startDate  : new Date(2019, 0, 1, 6),
    endDate    : new Date(2019, 0, 1, 20),
    viewPreset : 'hourAndDay',
    eventStyle : 'border',

    columns : [
        { type : 'resourceInfo', text : 'Name', field : 'name', width : 130, imagePath : '../_shared/images/users/' },
        { text : 'City', field : 'city', width : 90 }
    ],

    features : {
        stripe       : true,
        dependencies : true
    },

    assignmentStore,

    crudManager : {

        assignmentStore,

        transport : {
            load : {
                url : 'data/data.json'
            }
        },

        autoLoad : true
    }
});

Post by Alan »

Thank you! It works now when I reference assignmentStore twice, in the scheduler and in the crudManager.

Post Reply