Our pure JavaScript Scheduler component


Post by jamesbrown »

Hi Bryntum support we have a licence for scheuler pro but we are struggling please can you help us

Main Q: How can we set custom event editor > Vue component as event editor. The example(https://bryntum.com/docs/scheduler/guide/Scheduler/customization/replaceeventedit) doesn't work. We followed the documentation but before Event Edit listener wont work as it should. To be more precise, it never triggers. What are we missing here?

Questions:
How we can make “multi select input” like https://codesandbox.io/s/hx15r?
How we can make a row with 2 col custom inputs?
How we can create radio inputs?

import {Store} from '@bryntum/schedulerpro'
import Room from '@//components/bryntum/Room'
import Session from '@//components/bryntum/Session'
import SessionStore from '@/components/bryntum/SessionStore'

const SchedulerConfig = {
    rowHeight: 20,
    barMargin: 4,
    eventColor: 'indigo',
    mode: 'vertical',
    enableRecurringEvents : true,
    resourceImagePath: 'users/',
    columns: [
        {type: 'resourceInfo', field: 'title', text: 'Name', width: 165}
    ],
    viewPreset: {
        base: 'hourAndDay',
        tickWidth: 10,
        tickHeight: 50,
        columnLinesFor: 0,
        zoomLevel: 10,
        timeResolution: {            // Dates will be snapped to this resolution
            unit: 'minute',       // Valid values are 'millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'.
            increment: 15
        },
        headers: [
            {
                unit: 'd',
                align: 'center',
                dateFormat: 'ddd DD MMM'
            },
            {
                unit: 'h',
                align: 'center',
                dateFormat: 'HH:mm'
            }
        ]
    },

stripeFeature: true,
timeRangesFeature: true,
eventMenuFeature: {
    items: {
        // custom item with inline handler
        unassign: {
            text: 'Unassign',
            icon: 'b-fa b-fa-user-times',
            weight: 200,
            onItem: (eventRecord: any, resourceRecord: any) =>
                eventRecord.unassign(resourceRecord)
        }
    }
},
project: {
    autoLoad: true,
    eventModelClass: Session,
    resourceModelClass: Room,
    eventStore: SessionStore,
    resourceStore: {
        storeId: 'rooms'
    },
    autoSync: false,
    writeAllFields: true,
},

features: {
    taskEdit: {
        items: {
            generalTab: {
                // change title of General tab
                title : 'Session Details',
                weight: 0,
                items : {
                    percentDoneField: false,

                    sessionTypeField: {
                        type: 'combo',
                        label: 'Session Type',
                        items: ['Type A', 'Type B', 'Type C', 'Type D'],
                        name: 'type',
                        multiple: true,
                        weight: 0
                    },
                    nameField: {
                        label: 'Session Name',
                        weight: 2
                    },
                    resourcesField: {
                        label: 'Studio Name',
                        weight: 3
                    },
                    startDateField: {
                        label: 'Start date',
                        weight: 4
                    },
                    endDateField: {
                        label: 'End date',
                        weight: 5
                    },
                    startTimeField: {
                        label: 'Start time'
                    },
                    endTimeField: {
                        label: 'End time'
                    },
                    durationField: {
                        cls: '',
                        weight: 6,
                    },
                    repeatDailyCheckbox: {
                        type: 'checkbox',
                        label: 'Repeat Daily',
                        weight: 7
                    },
                    repeatWeeklyCheckbox: {
                        type: 'checkbox',
                        label: 'Repeat Weekly',
                    },
                    repeat2WeeklyCheckbox: {
                        type: 'checkbox',
                        name: '2week',
                        label: 'Repeat 2 Weekly',
                    },
                    repeatMonthlyCheckbox: {
                        type: 'checkbox',
                        label: 'Repeat Monthly',
                    },
                    // notifyDancersCheckbox: {
                    //     type: 'checkbox',
                    //     label: 'Notify dancers',
                    // },
                    // notifyBalletMasterCheckbox: {
                    //     type: 'checkbox',
                    //     label: 'Notify ballet master',
                    //     row: true,
                    //     rowCheckboxSelection: true,
                    // },
                    // notifyPianistsCheckbox: {
                    //     type: 'checkbox',
                    //     label: 'Notify pianists',
                    // },
                    // notifyAllCheckbox: {
                    //     type: 'checkbox',
                    //     label: 'Notify all users',
                    // }
                }
            },
            attendeesTab: {
                title : 'Session Attendees',
                weight: 2,
                items : {
                    dancersField: {
                        type: 'combo',
                        label: 'Dancers',
                        items: ['Dancer A', 'Dancer B', 'Dancer C'],
                        name: 'dancers',
                        weight: 0
                    },
                    groupsField: {
                        type: 'combo',
                        label: 'Groups',
                        items: ['Group A', 'Group B', 'Group C', 'Group D'],
                        name: 'groups',
                    },
                    balletMastersFiled: {
                        type: 'combo',
                        label: 'Ballet masters',
                        items: ['Master A', 'Master B', 'Master C', 'Master D'],
                        name: 'BalletMasters',
                    },
                    pianistsField: {
                        type: 'combo',
                        label: 'Pianists',
                        items: ['Pianist A', 'Pianist B', 'Pianist C', 'Pianist D'],
                        name: 'Pianists',
                    }
                }
            },
            performanceTab: {
                title : 'Session Specifics',
                weight: 3,
                items : {
                    performingField: {
                        type: 'combo',
                        label: 'Performing',
                        items: ['Dancer A', 'Dancer B', 'Dancer C', 'Dancer D'],
                        name: 'performing',
                        weight: 0
                    },
                    choreographerField: {
                        type: 'combo',
                        label: 'Choreographer',
                        items: ['Choreographer A', 'Choreographer B', 'Choreographer C', 'Choreographer D'],
                        name: 'groups',
                    },
                }
            },
            customNotesTab : {
                title : 'Notes',
                weight: 5,
                items : {
                    publicNotes: {
                        cls: 'textarea',
                        type: 'textarea',
                        label: 'Public notes',
                        name: 'publicNotes',
                    },
                    privateNotes: {
                        cls: 'textarea',
                        type: 'textarea',
                        label: 'Private notes',
                        name: 'privateNotes',
                    },
                    accessPermissions: {
                        type: 'combo',
                        label: 'Permission to access',
                        items: ['Dancer A', 'Dancer B', 'Dancer C', 'Dancer D'],
                        name: 'accessPermissions',
                        weight: 0
                    },
                }
            },
            predecessorsTab: false,
            successorsTab: false,
            notesTab : false,
            advancedTab : false,
        }
    },
    dependencies: false,
    timeRanges : {
        enableResizing      : true,
        showCurrentTimeLine : true,
        showHeaderElements  : true,
    },
    timeAxisHeaderMenu: {
        items: {
            extraItem: {
                text: 'Create New Studio',
                icon: 'b-fa-plus',
                onItem() {
                    //todo: replace with .env based url
                    location.href = ''
                }
            }
        }
    }
},

listeners: {
},

}
export {SchedulerConfig}

Post by saki »

The not-firing problem is most likely related to this issue: https://github.com/bryntum/support/issues/4049 However, nowhere in your code I see that you would install the listener.

To demonstrate the concept, I have added the listener to our resource-histogram Vue 3 demo. The resulting AppConfig.js is:

/**
 * Application configuration
 */
import { ProjectModel } from '@bryntum/schedulerpro';

const project = (window.project = new ProjectModel({
    transport : {
        load : {
            url : 'data/data.json'
        }
    },
    autoLoad  : true,

    // This config enables response validation and dumping of found errors to the browser console.
    // It's meant to be used as a development stage helper only so please set it to false for production systems.
    validateResponse : true
}));

const useSchedulerConfig = function() {
    return {
        flex              : '1 1 50%',
        startDate         : new Date(2020, 3, 26),
        endDate           : new Date(2020, 4, 10),
        viewPreset        : 'dayAndWeek',
        eventStyle        : 'plain',
        tickSize          : 70,
        resourceImagePath : 'users/',
        columns           : [
            {
                type  : 'resourceInfo',
                text  : 'Name',
                field : 'name',
                width : 130
            },
            { text : 'City', field : 'city', width : 90 }
        ],
        listeners: {
            beforeTaskEdit() {
                alert('Open your event editor here');
                return false;
            }
        }
    };
};

const useHistogramConfig = function() {
    return {
        flex                   : '1 1 50%',
        hideHeaders            : true,
        rowHeight              : 60,
        showBarTip             : true,
        scheduleTooltipFeature : false,
        nonWorkingTimeFeature  : true,
        resourceImagePath      : 'users/',
        columns                : [
            {
                type           : 'resourceInfo',
                text           : 'Name',
                field          : 'name',
                flex           : 1,
                showEventCount : false
            }
        ]
    };
};

export { useSchedulerConfig, useHistogramConfig, project };

Re multi-select: I believe this would do: https://bryntum.com/docs/scheduler-pro/api/Core/widget/Combo

Re radio: We currently do not have Radio control but it will be included in the next major release. See https://github.com/bryntum/support/issues/1357

Re "a row with 2 col custom inputs": Do you have any screenshot or sketch? Also where would you like to use such control?

PS: Next time, create forum threads one-per-question please.


Post Reply