Breaking Change T851209
Visible to All Users

Data Grid - The OptimizedMultipleSelectionChanged event has become asynchronous

In v19.2, we introduced a new API to bind the DxDataGrid component to data asynchronously. The previous synchronous version of the OptimizedMultipleSelectionChanged event would not work with asynchronous data binding. For this reason, we made this event asynchronous and no longer support the synchronous version.

The event's signature has been updated as follows:

Old:

Code
public Action<DataGridSelection<T>> OptimizedMultipleSelectionChanged { get; set; }

New:

Code
public Func<DataGridSelection<T>, Task> OptimizedMultipleSelectionChanged { get; set; }

The SelectedKeys and SelectedKeysMatchingFilter properties of the DataGridSelection class have also become asynchronous.

Old:

Code
public IEnumerable<object> SelectedKeys { get; } public IEnumerable<object> SelectedKeysMatchingFilter { get; }

New:

Code
public Task<IEnumerable<object>> SelectedKeys { get; } public Task<IEnumerable<object>> SelectedKeysMatchingFilter { get; }

If you handled the OptimizedMultipleSelectionChanged event, update the handler implementation similarly to the code below.

Old:

Code
<DxDataGrid Data="@DataSource" KeyFieldName="Id" SelectionMode="DataGridSelectionMode.OptimizedMultipleSelection" OptimizedMultipleSelectionChanged="OnSelectionChanged"> ... </DxDataGrid> @code { protected void OnSelectionChanged(DataGridSelection<ProductFlat> selection) { ... var selectedCount = selection.SelectedKeys.Count(); ... } }

New:

Code
<DxDataGrid Data="@DataSource" KeyFieldName="Id" SelectionMode="DataGridSelectionMode.OptimizedMultipleSelection" OptimizedMultipleSelectionChanged="OnSelectionChanged"> ... </DxDataGrid> @code { protected async Task OnSelectionChanged(DataGridSelection<ProductFlat> selection) { ... var selectedKeys = await selection.SelectedKeys; var selectedCount = selectedKeys.Count(); ... } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.