Skip to main content
A newer version of this page is available. .

ASPxClientGridView.SetColumnLayout(columnLayout) Method

Specifies the grid column’s layout.

Declaration

SetColumnLayout(
    columnLayout: any
): void

Parameters

Name Type Description
columnLayout any

An object specifying the grid column’s layout.

Remarks

To get the grid column’s layout, use the ASPxClientGridView.GetColumnLayout method.

Note

The SetColumnLayout method works only if the ASPxGridViewBehaviorSettings.ProcessColumnMoveOnClient property is set to true.

Example

The following example illustrates how to get and restore a column’s state on the client side.

The ASPxClientGridView.GetColumnLayout is used to get a column’s state.

var initialColumnLayout = null;
function Grid_Init(s, e) {
    initialColumnLayout = s.GetColumnLayout();
}

It returns an object that provides the following fields:

  • column field - Provides all the column’s information.
  • visibleIndex field - Provides the column’s visible index.
  • parentColumn field - Provides the parent column’s information. This field is null if you don’t use the banded columns.
{ “column”: ASPxClientGridViewColumn, “visibleIndex”: -1, “parentColumn”: ASPxClientGridViewColumn },

To restore the layout, use the client-side ASPxClientGridView.SetColumnLayout method and pass the previously obtained or customized layout.

function RestoreColumnLayout() {
    grid.SetColumnLayout(initialColumnLayout);
}

Result code:

function click() {
    RestoreColumnLayout();
}
var initialColumnLayout = null;
function Grid_Init(s, e) {
    initialColumnLayout = s.GetColumnLayout();
}
function RestoreColumnLayout() {
    grid.SetColumnLayout(initialColumnLayout);
}
See Also