Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

Column.setIndex

Sets the index of the column in the grid.

Syntax

public void setIndex( int index )

Parameters

index

The zero-based index that determines the new position for the column.

Remarks

Call setIndex to rearrange the columns in the grid. When you set a column's index property, the column is positioned at the specified index. The column that was previously at that index, and all subsequent columns, are shifted to the right (meaning their indices are increased by 1).

Note that every column, visible or hidden, has an index. For example, if you set the visible property of the first column to false, it still has an index of 0. The column that the user actually sees as the first column is still the second column in the grid, with an index of 1.

If you specify an index that lies outside the bounds of the grid's collection of columns, the column is positioned as either the first or the last column. For example, setting a column's index to a negative value positions the column as the first column. Setting the index to the value of the parent DataGrid control's columnCount property, or to a higher number, positions the column as the last column.

See Also   getIndex