Created
March 29, 2020 21:15
-
-
Save ctrl-alt-d/dc6d0472c67776d07a5cac324e90310e to your computer and use it in GitHub Desktop.
Cache for data grid component
This file contains hidden or 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