ColumnReorder

Allows user to reorder columns by dragging headers. To get notified about column reorder listen to change event on columns store.

Column reorder
//<code-header>
fiddle.title = 'Column reorder';
//</code-header>
const grid = new Grid({
    appendTo : targetElement,

    tbar : [
        {
            type    : 'slidetoggle',
            label   : 'Stretched drag proxy',
            checked : true,
            onChange({ value }) {
                grid.features.columnReorder.stretchedDragProxy = value;
            }
        }
    ],

    // makes grid as high as it needs to be to fit rows
    autoHeight : true,

    features : {
        // this feature is enabled by default,
        // so no need for this unless you have changed defaults
        columnReorder : {
            stretchedDragProxy : true
        }
    },

    data : DataGenerator.generateData(5),

    columns : [
        { field : 'firstName', text : 'First name', flex : 1 },
        { field : 'surName', text : 'Surname', flex : 1 },
        { type : 'date', field : 'start', text : 'Start', flex : 1 },
        { type : 'date', field : 'finish', text : 'Finish', flex : 1 }
    ]
});

This feature is enabled by default.

Configs

10

Common

disabledInstancePlugin
listenersEvents

Other

Set to true to stretch the column drag proxy element to cover the full height of the grid.

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Properties

17

Common

disabledInstancePlugin

Class hierarchy

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

Other

isReordering: Booleanreadonly

Returns true if a reorder operation is active

Set to true to stretch the column drag proxy element to cover the full height of the grid.

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Functions

28

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

10

This event is fired prior to starting a column drag gesture. The drag is canceled if a listener returns false.

// Adding a listener using the "on" method
columnReorder.on('beforeColumnDragStart', ({ source, column, event }) => {

});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

eventEvent

The browser event.

This event is fired when a column is dropped, and you can return false from a listener to abort the operation.

// Adding a listener using the "on" method
columnReorder.on('beforeColumnDropFinalize', ({ source, column, insertBefore, newParent, event, region }) => {

});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted.

newParentColumn

The new parent column.

eventEvent

The browser event.

regionString

The region where the column was dropped.

This event is fired when a column is being dragged, and you can set the valid flag on the context object to indicate whether the drop position is valid or not.

// Adding a listener using the "on" method
columnReorder.on('columnDrag', ({ source, column, insertBefore, event, context, context.valid }) => {

});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted (if not last).

eventEvent

The browser event.

contextObject
context.validBoolean

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

This event is fired when a column drag gesture has started.

// Adding a listener using the "on" method
columnReorder.on('columnDragStart', ({ source, column, event }) => {

});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

eventEvent

The browser event.

This event is always fired after a column is dropped. The valid param is true if the operation was not vetoed and the column was moved in the column store.

// Adding a listener using the "on" method
columnReorder.on('columnDrop', ({ source, column, insertBefore, newParent, valid, event, region }) => {

});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted.

newParentColumn

The new parent column.

validBoolean

true if the operation was not vetoed.

eventEvent

The browser event.

regionString

The region where the column was dropped.

catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin

Event handlers

10

This event is called prior to starting a column drag gesture. The drag is canceled if a listener returns false.

new ColumnReorder({
    onBeforeColumnDragStart({ source, column, event }) {

    }
});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

eventEvent

The browser event.

This event is called when a column is dropped, and you can return false from a listener to abort the operation.

new ColumnReorder({
    onBeforeColumnDropFinalize({ source, column, insertBefore, newParent, event, region }) {

    }
});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted.

newParentColumn

The new parent column.

eventEvent

The browser event.

regionString

The region where the column was dropped.

This event is called when a column is being dragged, and you can set the valid flag on the context object to indicate whether the drop position is valid or not.

new ColumnReorder({
    onColumnDrag({ source, column, insertBefore, event, context }) {

    }
});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted (if not last).

eventEvent

The browser event.

contextObject
context.validBoolean

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

This event is called when a column drag gesture has started.

new ColumnReorder({
    onColumnDragStart({ source, column, event }) {

    }
});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

eventEvent

The browser event.

This event is always called after a column is dropped. The valid param is true if the operation was not vetoed and the column was moved in the column store.

new ColumnReorder({
    onColumnDrop({ source, column, insertBefore, newParent, valid, event, region }) {

    }
});
ParameterTypeDescription
sourceGrid

The grid instance.

columnColumn

The dragged column.

insertBeforeColumn

The column before which the dragged column will be inserted.

newParentColumn

The new parent column.

validBoolean

true if the operation was not vetoed.

eventEvent

The browser event.

regionString

The region where the column was dropped.

onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin

Typedefs

1

CSS variables

1
NameDescription
--b-column-reorder-invalid-colorColor used on the drag proxy to highlight invalid drop locations