ASPxClientGridView.ColumnMoving Event
Enables you to control column movement.
Declaration
ColumnMoving: ASPxClientEvent<ASPxClientGridViewColumnMovingEventHandler<ASPxClientGridView>>
Event Data
The ColumnMoving event's data class is ASPxClientGridViewColumnMovingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
allow | Gets or sets whether a column is allowed to be moved. |
destinationColumn | Gets the target column, before or after which the source column will be inserted (if dropped). |
isDropBefore | Gets whether the source column will be inserted before the target column (if dropped). |
isGroupPanel | Gets whether the source column is currently over the Group Panel. |
sourceColumn | Gets the column currently being dragged by an end-user. |
Remarks
The ColumnMoving event is raised while an end-user moves a column via drag and drop, and enables you to control the drag and drop operation.
The event parameter’s ASPxClientGridViewColumnMovingEventArgs.sourceColumn property identifies the column currently dragged by an end-user. If the source column is over the Group Panel, the ASPxClientGridViewColumnMovingEventArgs.isGroupPanel property returns true
. If the source column is over the column header panel, the ASPxClientGridViewColumnMovingEventArgs.destinationColumn property returns the target column. In this instance, the ASPxClientGridViewColumnMovingEventArgs.isDropBefore property indicates whether the source column will be inserted before the destination column, if dropped.
To prevent the source column from being dropped at the current position, set the ASPxClientGridViewColumnMovingEventArgs.allow property to false
.
Example
This example shows how to prevent the First Name column from being dragged to the group panel.
<ClientSideEvents ColumnMoving="function(s, e) {
if(e.sourceColumn.fieldName == 'FirstName' && e.isGroupPanel)
e.allow = false;
}" />