Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion samples/grids/hierarchical-grid/state-persistence-main/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
Moving="true"
AllowFiltering="true"
Rendered="OnGridRendered"
DataChanged="OnGridDataChanged"
ColumnSelection="GridSelectionMode.Multiple"
RowSelection="GridSelectionMode.Multiple">
<IgbGridState @ref="gridState"></IgbGridState>
Expand Down Expand Up @@ -132,6 +133,7 @@
private IgbGridState gridState;
private IgbPaginator paginator;
private bool allOptions = true;
private bool ready = false;
private IgbGridStateOptions options = new IgbGridStateOptions()
{
CellSelection = true,
Expand Down Expand Up @@ -257,11 +259,25 @@
}
}

public void OnGridRendered()
public void OnGridDataChanged()
{
ready = true;
}

public async void OnGridRendered()
{
await WaitForGridReadyAsync();
RestoreGridState();
}

private async Task WaitForGridReadyAsync()
{
while (!ready)
{
await Task.Delay(100); // wait for update
}
}

async void LeavePage()
{
SaveGridState();
Expand Down