Our pure JavaScript Scheduler component


Post by jenniferht »

Hello,
Is it possible to customize the default name "new event" when using

EventDragCreate

? We would like to change it to a custom name, or value of our choice.

please provide the steps to follow, and any assistance with the example code would be appreciated.


Post by mats »

Sure, you can either define this text on your Event Model name field as the defaultValue. Or use localization of this key:

Object.newEvent

https://bryntum.com/products/scheduler/docs/guide/Scheduler/customization/localization

class Task extends EventModel {
    static get fields() {
        return [
            { name : 'name', defaultValue : 'The new thing' }
        ];
    }
}

Post by jenniferht »

Hi,
I'm inquiring about the name within the event, not the name featured in the edit event popup.

I'm trying to update it as below examples:

    
schedulerConfig.on('dragCreateEnd', ({ source, eventRecord, resourceRecord, event, eventElement }) => {
createdPrice = "$300 eventRecord.originalData.name = createdPrice; }) schedulerConfig.on('dragCreateStart', ({ eventRecord, resourceRecord }) => { createdPrice = "$300 eventRecord.originalData.name = createdPrice; })
Attachments
simplescreenrecorder-2024-03-10_21.15.42.mp4
(541.82 KiB) Downloaded 8 times

Post by mats »

That's exactly what you get if you follow the steps above. Example:

new Scheduler({
    appendTo    : 'container',
    startDate   : new Date(2023, 0, 29),
    endDate     : new Date(2023, 1, 12),
    viewPreset  : 'weekAndDayLetter',
    rowHeight   : 100,
    tickSize    : 75,
    crudManager : {
        autoLoad   : true,
        eventStore : {
            // Custom fields used on events in the demo
            fields : [
                { name : 'name',  defaultValue : 'Foo' }
            ]
        },

Post by jenniferht »

Thanks working fine


Post Reply