Bug: Grid documentation for Built-in and Custom items in a toolbar Blazor
Followed the instructions on this page for "Built-in and Custom items in a toolbar" section and received an error:
https://blazor.syncfusion.com/documentation/datagrid/tool-bar/#built-in-and-custom-items-in-toolbar
```
blazor.server.js:19 [2020-10-30T22:13:56.036Z] Error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Syncfusion.Blazor.Grids.Internal.GridToolbar`1.<>c__DisplayClass22_0.<GetAttributes>b__2(String dItem)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at Syncfusion.Blazor.Grids.Internal.GridToolbar`1.GetAttributes(Dictionary`2 DynamicDisableItems, IDictionary`2 _toolOptions, Object currentItem)
at Syncfusion.Blazor.Grids.Internal.GridToolbar`1.<>c__DisplayClass0_0.<BuildRenderTree>b__1(RenderTreeBuilder __builder3)
at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
at Syncfusion.Blazor.Navigations.ToolbarItems.<BuildRenderTree>b__15_0(RenderTreeBuilder __builder2)
at Microsoft.AspNetCore.Components.CascadingValue`1.Render(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
e.log @ blazor.server.js:19
```
```
<SfGrid ID="GridModules" DataSource="@DataModules" AllowPaging="true" AllowFiltering="true"
AllowGrouping="false" AllowReordering="true" AllowResizing="true"
AllowSorting="true" AllowTextWrap="true" ShowColumnChooser="true" ShowColumnMenu="true"
AllowPdfExport="true" AllowExcelExport="true"
Toolbar="Toolbaritems"
ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "SortAscending", "SortDescending", "Copy", "Edit", "Delete", "Save", "Cancel", "PdfExport", "ExcelExport", "CsvExport", "FirstPage", "PrevPage", "LastPage", "NextPage" })">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>
<GridPageSettings PageCount="20"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(Module.ModuleId) HeaderText="Id" Visible="false"></GridColumn>
<GridColumn Field=@nameof(Module.Name) HeaderText="Name" ValidationRules="@(new ValidationRules { Required = true })"></GridColumn>
</GridColumns>
<GridEvents OnToolbarClick="ToolbarModules" TValue="Module" OnActionComplete="ActionModules"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="@EditMode.Dialog" Dialog="DialogParams">
<HeaderTemplate>
@{
if (IsEditMode)
{
<div>Module</div>
}
else
{
<div>Add Module</div>
}
}
</HeaderTemplate>
<Template>
@{
var record = (context as Module);
}
<div>
<div class="form-row">
<div class="form-group col-md-12">
<SfTextBox ID="Name" @bind-Value="@(record.Name)" FloatLabelType="FloatLabelType.Always" Placeholder="Name"></SfTextBox>
</div>
</div>
</div>
</Template>
</GridEditSettings>
</SfGrid>
@code{
private List<Object> Toolbaritems = new List<Object>() { "Add", "Edit", "Delete", "Update", "Cancel", new ItemModel() { Text = "Click", TooltipText = "Click", PrefixIcon = "e-click", Id = "Click" } };
}
```
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
RN
Rahul Narayanasamy
Syncfusion Team
November 2, 2020 09:17 AM UTC
Hi Scott,
Greetings from Syncfusion.
Query: Bug: Grid documentation for Built-in and Custom items in a toolbar Blazor
We have validated your query with the provided information and it was an known issue “Exception throws while defining Custom toolbar items in Grid” at our end. We have already included the fix for the issue in our latest version(18.3.0.44).
Reference:
Could you please ensure the reported problem in latest version at your end?
Please let us know if you have any concerns.
Regards,
Rahul
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
SP Scott Peal
- Oct 30, 2020 10:19 PM UTC
- Nov 2, 2020 09:17 AM UTC