Unplanned
Last Updated: 03 Oct 2024 08:31 by Roberto
Roberto
Created on: 02 Oct 2024 08:13
Category: Grid
Type: Feature Request
4
Expose the current data in its current state

Please expose the current data of the Grid and TreeList when using Data or OnRead. This will spare the need to cache data for the second time in-memory, or repeat all data operations. The benefit is that the app can:

  • Know what data items the user is seeing.
  • Obtain the data it its current shape / state.

 

3 comments
Roberto
Posted on: 02 Oct 2024 11:04

A similar feature we implemented in the combobox with the following code:

public TItem GetSelectedItem()
{
    return SelectedDataItem != null && SelectedDataItem.DataItem != null ? (TItem)SelectedDataItem.DataItem.Clone() : default(TItem);
}

public ReadOnlyCollection<TItem> GetAllReadonlyDataItems()
{
    List<TItem> dataItems = new List<TItem>();

    foreach (var item in DataItems)
    {
        if (item.DataItem is TItem dataItem)
        {
            var clonedDataItem = (TItem)dataItem.Clone();
            dataItems.Add(clonedDataItem);
        }
    }

    return new ReadOnlyCollection<TItem>(dataItems);
}