Skip to content

Commit 423f87f

Browse files
authored
Merge pull request #1158 from IgniteUI/mkirova/fix-1147
Add delay since on grid rendered column have not init yet, hence filt…
1 parent 2db4a16 commit 423f87f

File tree

1 file changed

+17
-1
lines changed
  • samples/grids/hierarchical-grid/state-persistence-main

1 file changed

+17
-1
lines changed

samples/grids/hierarchical-grid/state-persistence-main/App.razor

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
Moving="true"
6565
AllowFiltering="true"
6666
Rendered="OnGridRendered"
67+
DataChanged="OnGridDataChanged"
6768
ColumnSelection="GridSelectionMode.Multiple"
6869
RowSelection="GridSelectionMode.Multiple">
6970
<IgbGridState @ref="gridState"></IgbGridState>
@@ -132,6 +133,7 @@
132133
private IgbGridState gridState;
133134
private IgbPaginator paginator;
134135
private bool allOptions = true;
136+
private bool ready = false;
135137
private IgbGridStateOptions options = new IgbGridStateOptions()
136138
{
137139
CellSelection = true,
@@ -257,11 +259,25 @@
257259
}
258260
}
259261

260-
public void OnGridRendered()
262+
public void OnGridDataChanged()
261263
{
264+
ready = true;
265+
}
266+
267+
public async void OnGridRendered()
268+
{
269+
await WaitForGridReadyAsync();
262270
RestoreGridState();
263271
}
264272

273+
private async Task WaitForGridReadyAsync()
274+
{
275+
while (!ready)
276+
{
277+
await Task.Delay(100); // wait for update
278+
}
279+
}
280+
265281
async void LeavePage()
266282
{
267283
SaveGridState();

0 commit comments

Comments
 (0)