@page "/tree-sample1"
<h3>TreeSample1</h3>
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.TreeGrid

<SfTreeGrid  Height="500" DataSource="@ResourceDtoS"  
            EnableAltRow="true" GridLines="GridLine.Both" AllowReordering="true" AllowResizing=true
            AllowFiltering=true  
            IdMapping="@nameof(ResourceDto.Id)" ParentIdMapping="@nameof(ResourceDto.ParentId)"
          TValue="ResourceDto"  TreeColumnIndex="0">
    @*<TreeGridEvents TValue="ResourceDto" OnToolbarClick="ToolBarClick"></TreeGridEvents>*@
    <TreeGridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"
                          Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch"></TreeGridEditSettings>

    <TreeGridColumns>
        @*<TreeGridColumn Field=@nameof(ResourceDto.Id) HeaderText="Task ID" Width="80" TextAlign="TextAlign.Right"></TreeGridColumn>*@

        <TreeGridColumn Field=@nameof(ResourceDto.DescZhCN) HeaderText="DescZhCN" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.DescEn) HeaderText="DescEn" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.DescZh) HeaderText="DescZh" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.Key) HeaderText="Key" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.Remark) HeaderText="Remark" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.Path) HeaderText="Path" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.Icon) HeaderText="Icon" Width="80"> </TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.Order) HeaderText="Order" Width="80"></TreeGridColumn>
        @*<TreeGridColumn Field=@nameof(ResourceDto.ParentId) HeaderText="ParentId" Width="80"></TreeGridColumn>*@
        <TreeGridColumn Field=@nameof(ResourceDto.Type) HeaderText="Type" Width="80">  </TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.IsLocked) HeaderText="IsLocked" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.IsDeleted) HeaderText="IsDeleted" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.CreatorId) HeaderText="CreatorId" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.LastUpdater) HeaderText="LastUpdater" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.CreatedTime) HeaderText="CreatedTime" Width="80"></TreeGridColumn>
        <TreeGridColumn Field=@nameof(ResourceDto.UpdatedTime) HeaderText="UpdatedTime" Width="80"></TreeGridColumn>
    </TreeGridColumns>
</SfTreeGrid>

@code {
    public List<ResourceDto> ResourceDtoS { get; set; }
    protected override void OnInitialized()
    {
        base.OnInitialized();
        ResourceDtoS = System.Text.Json.JsonSerializer.Deserialize<List<ResourceDto>>(AppData.DataFull);
    }
}
