Our pure JavaScript Scheduler component


Post by Landpoint »

Hello,

As I mentioned in another forum post yesterday, I am attempting to run a schedule with multiple drag sources.
For the most part this had been successful, however, I have come to a stopping point with it. My 2nd drag source is not populated with a readUrl, but instead, I just set the data of the store on a call back function from my own API.
For the most part, this works great, with the exception that the listener on the store of my new Grid never fires. and as a result, the scheduler store for the list of items in my 2nd list is never populated with its options.

Here is the code I am referring to:
this.equipmentGrid2 = new EmployeeGrid({
    id: 'equipment2',
    appendTo: 'teamMembers',
    eventStore: this.schedule.events,
    store: {
        modelClass: Task,
        //autoLoad: true,
        data: this.resources,
        sorters: [
            { field: 'name', ascending: true }
        ],
        listeners: {
            load: (event) => {
                //THIS NEVER FIRES
                this.schedule.employeeStore = event.source;
            }
        }
    }
});
While I can appreciate the use of the CRUD Manager in the tool, My API does not have an easily accessible URL to hit, so I have to (I suppose) manually set the data and disable the autoLoad.

Any Advice is appreciated

Post by pmiklashevich »

Well there is a trigger function in Events mixin.
In Basic demo please run in console:
scheduler.eventStore.on('load', console.log, console);
scheduler.eventStore.trigger('load', {data : {test : 1}});
But I'm not sure it should be done this way. Since you set data synchronously in the callback of your AJAX request, you can call another handler in the same callback, or fire your custom event there.

Hope this will help you to move further.

Cheers,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by Landpoint »

Great!
Yes, I was able to get it to work in this case

Post Reply