Treegrid still gives errors

Error Message :  Specified argument was out of the range of valid values. (Parameter 'index')


https://www.syncfusion.com/forums/188495/working-with-treegrid-is-not-easy


I recently applied the patch to treegrid because it said there was a bug.


However, I still get an error.


The source is below.


I tested it on 2 versions, 24.2.3 and 26.2.7, and the same error occurred. )


<SfTreeGrid @ref="obj_Grid_Menu" DataSource="@ds_MenuTree" Height="100%" Width="auto" IdMapping="MenuId" ParentIdMapping="ParentMenuId" TreeColumnIndex="2" AllowPaging="false"

            AllowSorting="false" AllowTextWrap="true" GridLines="GridLine.Both" RowHeight="25">

    <TreeGridEvents OnBatchSave="Grid_UserMenu_Save"

                    CellSelected="CellSelectHandler"

                    TValue="MenuList"></TreeGridEvents>

    <TreeGridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" ShowConfirmDialog="false"

        Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch" NewRowPosition="Syncfusion.Blazor.TreeGrid.RowPosition.Below"></TreeGridEditSettings>

    <TreeGridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Both"></TreeGridSelectionSettings>

    <TreeGridColumns>

        <TreeGridColumn Field=@nameof(MenuList.MenuId) HeaderTextAlign="TextAlign.Center" HeaderText="Id" Width="80" ValidationRules="@(new ValidationRules() { Required = true, Number = true })" IsPrimaryKey="true" Visible="false" TextAlign="TextAlign.Center"></TreeGridColumn>

        <TreeGridColumn Field=@nameof(MenuList.PageName) HeaderTextAlign="TextAlign.Center" HeaderText="페이지경로" TextAlign="TextAlign.Left" Width="150" ValidationRules="@(new ValidationRules() { Required = true })">

            <EditTemplate>

                @{

                    var menuList = (context as MenuList);

                    <STEF_TextBox @ref="txt_pagenm"

                                  p_enabled="@b_PageNameEnableCheck"

                                  @bind-p_value="@((context as MenuList).PageName)"

                                  p_valuechange="@Grid_PageName_CodeChange"

                                  p_placeholder="페이지경로를 입력해주세요."></STEF_TextBox>

                }

            </EditTemplate>

        </TreeGridColumn>

        <TreeGridColumn Field=@nameof(MenuList.MenuName) HeaderTextAlign="TextAlign.Center" HeaderText="메뉴명" TextAlign="TextAlign.Left" Width="180" ValidationRules="@(new ValidationRules() { Required = true })">         

        </TreeGridColumn>

    </TreeGridColumns>

</SfTreeGrid>


3 Replies 1 reply marked as answer

PS Pon Selva Jeganathan Syncfusion Team August 7, 2024 01:24 PM UTC

Hi junghwi,


We have prepared a sample based on your shared code snippet with latest version. However, we were unable to replicate the issue at our end. So we suggest you to use the latest version(26.2.7) to avoid the issue. We have ensured this scenario with edit template and column template.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp7563570


Video demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Video_add-_26.2.7703382817


If the issue persists in your scenario, we kindly request you to provide us with below details:


  1. Complete treegrid code example(with event handling details)
  2. Issue replication steps
  3. Stacktrace details
  4. Share video demo to replicate the issue.


This information will help us to better understand, find the exact cause of the issue and provide a more accurate solution.


Regards,

Pon selva




Marked as answer

JU junghwi August 9, 2024 02:27 AM UTC

Thanks for the reply. There was an error in my custom code when adding the grid.



PS Pon Selva Jeganathan Syncfusion Team August 9, 2024 12:02 PM UTC

Hi junghwi,


Thanks for your update. If you encounter any further problems with the TreeGrid, please don't hesitate to reach out. We're here to assist you.


Kindly get back to us for further assistance.


Regards,

Pon selva


Loader.
Up arrow icon