Skip to content

Commit 72903ef

Browse files
chore(grid): fix single selection example to be synchronous
1 parent 90c795f commit 72903ef

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

components/grid/selection/single.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ The example below shows how to handle the `SelectedItemsChanged` event to extrac
135135
public Employee SelectedEmployee { get; set; }
136136
public List<Employee> TeamMatesList { get; set; }
137137
138-
protected async Task OnSelect(IEnumerable<Employee> employees)
138+
protected void OnSelect(IEnumerable<Employee> employees)
139139
{
140140
SelectedEmployee = employees.FirstOrDefault();
141141
// update the collection so that the grid can highlight the correct item
142142
// when two-way binding is used this happens automatically, but the framework does not allow two-way binding and the event at the same time
143143
SelectedItems = new List<Employee> { SelectedEmployee };
144144
145-
await GetChildGridData();
145+
GetChildGridData(); // note: an async operation here can break the selection and may not even render its results in the view
146146
}
147147
148-
async Task GetChildGridData()
148+
void GetChildGridData()
149149
{
150150
if (TeamMatesList == null)
151151
{
@@ -172,7 +172,7 @@ The example below shows how to handle the `SelectedItemsChanged` event to extrac
172172
// add default selection and execute its logic. Not required
173173
SelectedItems = new List<Employee> { GridData.FirstOrDefault() };
174174
SelectedEmployee = GridData.FirstOrDefault();
175-
await GetChildGridData();
175+
GetChildGridData();
176176
}
177177
178178
public class Employee
@@ -184,8 +184,6 @@ The example below shows how to handle the `SelectedItemsChanged` event to extrac
184184
}
185185
````
186186

187-
@[template](/_contentTemplates/common/general-info.md#event-callback-can-be-async)
188-
189187
@[template](/_contentTemplates/common/issues-and-warnings.md#valuechanged-lambda-required)
190188

191189
### Two-way Binding of SelectedItems

0 commit comments

Comments
 (0)