Our pure JavaScript Scheduler component


Post by raade »

Hello,

is there any option to disable / limit the time adjustements you can make to an event so you just can assign resources to it but no more?

currently i'm using things like:
beforeEventDropFinalize: ({context}) => {
    context.startDate = context.origStart;
    context.endDate = context.origEnd;
}
but since im just changing the time afterwards, settings like allowOverlap wont work.

thanks

Post by pmiklashevich »

Hello,

Basically getDateConstraints should work, but I found a bug in our sources: https://app.assembla.com/spaces/bryntum/tickets/8934-drop-date-is-resolved-based-on-cursor-position-instead-of-proxy-element/details

Meanwhile you can use validatorFn and snap/snapRelativeToEventStartDate configs to make drop position clear to the end users.
snap                         : true,
snapRelativeToEventStartDate : true,

features : {
    eventDrag : {
        validatorFn({ origStart, startDate }) {
            return origStart - startDate === 0;
        }
    }
},

Pavlo Miklashevych
Sr. Frontend Developer


Post by raade »

Thanks!

i saw that there was a new version released in the last few days. does it include the getDateConstraints bugfix?

i tried using it but it didn't do anything (used as direct/0 depth Sheduler option) like this: (and it does get called twice on drag start)
//new Scheduler({
//...
//direct scheduler option, not inside a child option
getDateConstraints: (resourceRecord, eventRecord) => {
    return {
        start: eventRecord.startDate,
        end: eventRecord.endDate,
    };
},
snap: true,
allowOverlap: false,
//...
//});

Post by pmiklashevich »

Nope, sorry. The status is still "New". You can track it in our bug tracker. Cheers!

Pavlo Miklashevych
Sr. Frontend Developer


Post by raade »

pmiklashevich wrote: Mon Jul 22, 2019 10:40 am Nope, sorry. The status is still "New". You can track it in our bug tracker. Cheers!
Hey Pavel, thanks for the info. We've been tracking the ticket and we've noticed that Mats has unassigned it from himself and assigned it to nobody at all anymore.

Is there anything we can do to expedite the resolution of this issue? We're willing to pay a reasonable one-time premium for example. Please let us know if that is something you're interested in.

Post by saki »


Post by Animal »

This has been a merry chase. We have reinforced the underlying APIs to support event drag better.

So now, not only does the physical drag honour the values you return from getDateConstraints, but the actual drop processing does too.

In terms of using the validator function to do what you need, as well as returning a boolean, an object can be returned containing a flag and a message why the drop is invalid, so you could do this:
features : {
    eventDrag : {
        validatorFn({ origStart, startDate }) {
            return origStart - startDate === 0 ? true : {
                valid : false,
                message : 'May not change time slot'
            };
        }
    }
},
The message appears in the drag tooltip.

But along with this ticket, there's going to be a simplified config added to the EventDrag feature:
            features : {
                eventDrag : {
                    constrainToTimeSlot : true // May only move events from resource to resource
                }
            }
Screenshot 2019-12-18 at 12.33.07.png
Screenshot 2019-12-18 at 12.33.07.png (70.78 KiB) Viewed 1080 times

Post Reply