ResourceColumnReorder

Allows user to reorder resource columns in vertical mode by dragging them. The feature fires various events during the drag operation (see events below). To get notified about the actual resource reorder, you can also listen to the change event on the scheduler ResourceStore.

This feature is disabled by default and only works when the scheduler is in vertical mode.

Resource column reorder
//<code-header>
fiddle.title = 'Resource column reorder';
//</code-header>
const scheduler = new Scheduler({
    appendTo : targetElement,

    height : '22em',

    startDate : new Date(2022, 4, 1),
    endDate   : new Date(2022, 4, 7),
    mode      : 'vertical',

    resources : [
        { id : 1, name : 'Greta' },
        { id : 2, name : 'Ingrid' },
        { id : 3, name : 'John' },
        { id : 4, name : 'Kate' }
    ],

    events : [
        { id : 1, resourceId : 1, name : 'Interview', startDate : '2022-05-02', endDate : '2022-05-03' },
        { id : 2, resourceId : 2, name : 'Press meeting', startDate : '2022-05-03', endDate : '2022-05-04' },
        { id : 3, resourceId : 3, name : 'Audition', startDate : '2022-05-02', endDate : '2022-05-05' },
        { id : 4, resourceId : 4, name : 'Meeting', startDate : '2022-05-04', endDate : '2022-05-06' }
    ],

    features : {
        resourceColumnReorder : true
    }
});

Basic usage

const scheduler = new Scheduler({
    mode     : 'vertical',
    features : {
        resourceColumnReorder : true
    }
});

Validation

You can validate the drag drop flow by listening to the resourceColumnDrag event:

const scheduler = new Scheduler({
    mode     : 'vertical',
    features : {
        resourceColumnReorder : true
    },
    listeners : {
        resourceColumnDrag({ context }) {
            // Prevent dropping on certain resources
            if (context.insertBefore?.isSpecialResource) {
                context.valid = false;
            }
        }
    }
});

Configs

9

Common

disabledInstancePlugin
listenersEvents

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Other

Properties

15

Common

disabledInstancePlugin

Class hierarchy

isResourceColumnReorder: Boolean= truereadonly
Identifies an object as an instance of ResourceColumnReorder class, or subclass thereof.
isResourceColumnReorder: Boolean= truereadonlystatic
Identifies an object as an instance of ResourceColumnReorder class, or subclass thereof.
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Other

Functions

28

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

11

Fired before dragging starts, return false to prevent the drag operation.

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnBeforeDragStart', ({ source, context, context.resource, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent | TouchEvent

Fired before the drop is finalized. You can return false or a Promise that resolves to false to cancel the drop operation.

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnBeforeDropFinalize', ({ source, context, context.resource, context.insertBefore, context.targetGroup, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

context.insertBeforeResourceModel

The resource to insert before

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group

eventMouseEvent

Fired while the resource column is being dragged. You can signal that the drop position is valid or invalid by setting context.valid = false;

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnDrag', ({ source, context, context.valid, context.insertBefore, context.resource, context.targetGroup, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.validBoolean

Set this to true or false to indicate whether the drop position is valid

context.insertBeforeResourceModel

The resource to insert before (null if inserting at last position)

context.resourceResourceModel

The dragged resource

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group

eventMouseEvent

Fired when drag is aborted

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnDragAbort', ({ source, context, context.resource, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent

Fired when dragging starts.

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnDragStart', ({ source, context, context.resource, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent | TouchEvent

Fired after drop

// Adding a listener using the "on" method
resourceColumnReorder.on('resourceColumnDrop', ({ source, context, context.resource, context.insertBefore, context.targetGroup, context.valid, event }) => {

});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

context.insertBeforeResourceModel

The resource that was inserted before

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group. The resource's group field has been updated if moved between groups.

context.validBoolean

true if the drop was valid, false otherwise

eventMouseEvent
catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin

Event handlers

11

Called before dragging starts, return false to prevent the drag operation.

new ResourceColumnReorder({
    onResourceColumnBeforeDragStart({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent | TouchEvent

Called before the drop is finalized. You can return false or a Promise that resolves to false to cancel the drop operation.

new ResourceColumnReorder({
    onResourceColumnBeforeDropFinalize({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

context.insertBeforeResourceModel

The resource to insert before

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group

eventMouseEvent

Called while the resource column is being dragged. You can signal that the drop position is valid or invalid by setting context.valid = false;

new ResourceColumnReorder({
    onResourceColumnDrag({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.validBoolean

Set this to true or false to indicate whether the drop position is valid

context.insertBeforeResourceModel

The resource to insert before (null if inserting at last position)

context.resourceResourceModel

The dragged resource

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group

eventMouseEvent

Called when drag is aborted

new ResourceColumnReorder({
    onResourceColumnDragAbort({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent

Called when dragging starts.

new ResourceColumnReorder({
    onResourceColumnDragStart({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

eventMouseEvent | TouchEvent

Called after drop

new ResourceColumnReorder({
    onResourceColumnDrop({ source, context, event }) {

    }
});
ParameterTypeDescription
sourceScheduler
contextObject
context.resourceResourceModel

The dragged resource

context.insertBeforeResourceModel

The resource that was inserted before

context.targetGroupModel

When the resourceStore is grouped, the group header record of the target group. The resource's group field has been updated if moved between groups.

context.validBoolean

true if the drop was valid, false otherwise

eventMouseEvent
onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin

Typedefs

1

CSS variables

5
NameDescription
--b-resource-column-reorder-indicator-sizeDrop indicator size (width for vertical line)
--b-resource-column-reorder-indicator-colorDrop indicator color
--b-resource-column-reorder-indicator-invalid-colorDrop indicator color when invalid
--b-resource-column-reorder-box-shadowDrag proxy box shadow
--b-resource-column-reorder-proxy-opacityOpacity of the drag proxy (column being dragged)