Cache for data grid component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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