DxGridColumn.VisibleIndexChanged Event
Fires when the column’s visible index changes.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v21.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public EventCallback<int> VisibleIndexChanged { get; set; }
Parameters
Type | Description |
---|---|
Int32 | A new value of the VisibleIndex property. |
Remarks
The VisibleIndex property allows you to define display order for Grid columns explicitly. Users can then reoder columns at runtime. Handle the VisibleIndexChanged
event to respond to column position changes.
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" VisibleIndex="@Index"
VisibleIndexChanged="OnVisibleIndexChanged"/>
<DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" />
<DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" />
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover" />
</Columns>
</DxGrid>
<div>@IndexInfo</div>
@code {
object Data { get; set; }
int Index { get; set; }
string IndexInfo { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
void OnVisibleIndexChanged(int newIndex) {
Index = newIndex;
IndexInfo = "You moved the 'Date' column to position " + (newIndex + 1);
}
}
See Also