I have a Grid where i'm using the standard buttons and attempting to add another button but i'm getting an error. I'm trying to set the toolbar to this: private List<Object> Toolbaritems = new List<Object>() { "Add", "Edit", "Delete", "Update", "Cancel", new ItemModel() { Text = "Click", TooltipText = "Click", PrefixIcon = "e-click", Id = "Click" } };
My Grid uses batch edit mode
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.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
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()
<SfGrid @ref="GridInstance" DataSource="@chemOrderLines" AllowPaging="false" AllowFiltering="true" AllowSorting="true" AllowMultiSorting="true" AllowResizing="true" Width="1200" AllowReordering="true" ShowColumnChooser="true" Toolbar="Toolbaritems" Height="600">
<GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple" Mode="Syncfusion.Blazor.Grids.SelectionMode.Both"></GridSelectionSettings>
<GridEditSettings ShowConfirmDialog="false" AllowAdding="true" AllowEditing="true" AllowDeleting="true" AllowNextRowEdit="true" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents OnToolbarClick="ToolbarClickHandler" CellSelected="CellSelectHandler" RowSelecting="RowSelectingHandler" TValue="FDIChemicalOrderLine" OnBatchSave="OnSave" OnBatchAdd="OnAdd"></GridEvents>
<GridColumns>
<GridColumn FilterSettings="@(new FilterSettings{ Operator = Syncfusion.Blazor.Operator.Contains })" Field=@nameof(FDIChemicalOrderLine.ID) IsPrimaryKey="true" ValidationRules="@(new ValidationRules { Required = true })" HeaderText="ID" Visible="false" TextAlign="TextAlign.Right" Type="ColumnType.Number" AutoFit="true"></GridColumn>
<GridColumn FilterSettings="@(new FilterSettings{ Operator = Syncfusion.Blazor.Operator.Contains })" Field=@nameof(FDIChemicalOrderLine.SortOrder) HeaderText="Sort Order" TextAlign="TextAlign.Right" Type="ColumnType.Number" AutoFit="true"></GridColumn>
<GridColumn FilterSettings="@(new FilterSettings{ Operator = Syncfusion.Blazor.Operator.Contains })" Field=@nameof(FDIChemicalOrderLine.FSBillingLocationId) HeaderText="Billing Location" AutoFit="true"> </GridColumn>
<GridColumn FilterSettings="@(new FilterSettings{ Operator = Syncfusion.Blazor.Operator.Contains })" Field=@nameof(FDIChemicalOrderLine.FSDeliveryLocationId) HeaderText="Delivery Location" TextAlign="TextAlign.Right" EditType="EditType.DropDownEdit" Width="200">
<EditTemplate>
<SfComboBox @ref="comboboxLocationAddress" ID="FSDeliveryLocationId" TValue="string" TItem="FDILocationAddress" @bind-Value="(context as FDIChemicalOrderLine).FSDeliveryLocationId" Placeholder="e.g. 02-36-001-13W2" CssClass="e-multi-column" DataSource="@locationAddresses" AllowFiltering="true" PopupWidth="400px">
<ComboBoxFieldSettings Text="locationAddress" Value="locationAddress"></ComboBoxFieldSettings>
<ComboBoxTemplates TItem="FDILocationAddress">
<HeaderTemplate>
<table><tr><th class="e-text-center">Address</th></tr></table>
</HeaderTemplate>
<ItemTemplate Context="context2">
<table><tbody><tr><td class="e-text-center">@((context2 as FDILocationAddress).locationAddress)</td></tr> </tbody></table>
</ItemTemplate>
</ComboBoxTemplates>
<ComboBoxEvents TValue="string" TItem="FDILocationAddress" Filtering="onFilteringLocation" ValueChange="@filterLocationValueChange"></ComboBoxEvents>
</SfComboBox>
</EditTemplate>
</GridColumn>