DxGridColumn.VisibleIndex Property
Specifies a column’s position among other columns.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v22.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(-1)]
[Parameter]
public int VisibleIndex { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Int32 | -1 | The column’s visible index. |
Remarks
The Grid renders all columns in the same order as they are declared in markup.
You can use the VisibleIndex
property to specify display order for columns explicitly. The Grid first renders columns with this property specified: the lower the value, the earlier the column is drawn. Then, the Grid renders columns with unspecified VisibleIndex
property in the same order as they are declared in markup.
Users can invoke the Column Chooser to reorder grid columns. In this case, the value of the column’s VisibleIndex property changes.
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" VisibleIndex="0"/>
<DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" VisibleIndex="2"/>
<DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" VisibleIndex="1"/>
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover" />
</Columns>
</DxGrid>
@code {
object Data { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
}
Users can reorder columns at runtime. Handle a column’s VisibleIndexChanged event to respond to column position changes.
You can call the Grid’s GetVisibleColumns() method to get a collection where columns are ordered based on visible indexes. To obtain a column collection declared in markup, call the GetColumns() method.
Note
Grouped columns are considered invisible if the ShowGroupedColumns property is set to false
(the default value).