Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cache for data grid component
[Parameter]
public IEnumerable<object> DataSource {set; get; }
private IEnumerable<object> Cache {set; get; } = null;
List<MyColumn> Columns = new List<MyColumn>();
public void AddColumn(MyColumn column)
{
var seg = DataSource;
Cache ??= DataSource.ToList();
DataSource = Cache;
Columns.Add(column);
StateHasChanged();
DataSource = seg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment