async extensions for blazor
Enables rendering of a list of items asynchronously. The items are rendered as they are received from the server.
Add [StreamRendering(true)]
to the page component to enable streaming rendering.
The default implementation of AsyncRenderer
will render the items as a list of divs. If no ItemTemplate
is provided, the ToString
method will be called on each item.
<AsyncRenderer Items="items" />
<table>
<thead>
<tr>
<th>Item</th>
</tr>
</thead>
<tbody>
<AsyncRenderer Items="items" Element="tr">
<ItemTemplate>
<td>@context.Name</td>
</ItemTemplate>
</AsyncRenderer>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Item</th>
</tr>
</thead>
<tbody>
<AsyncRenderer Items="items" Element="tr" T="Person" TOrderKey="string" OrderBy="p => p.Name">
<ItemTemplate>
<td>@context.Name</td>
</ItemTemplate>
</AsyncRenderer>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Item</th>
</tr>
</thead>
<tbody>
<AsyncRenderer Items="items" Element="tr" T="Person" TOrderKey="string" OrderByDescending="p => p.Name">
<ItemTemplate>
<td>@context.Name</td>
</ItemTemplate>
</AsyncRenderer>
</tbody>
</table>