diff --git a/grid-sdk/blazor/tree-grid/how-to/row-cell-index.md b/grid-sdk/blazor/tree-grid/how-to/row-cell-index.md new file mode 100644 index 00000000..0c639bec --- /dev/null +++ b/grid-sdk/blazor/tree-grid/how-to/row-cell-index.md @@ -0,0 +1,90 @@ +--- +layout: post +title: Blazor TreeGrid Get Selected Row Cell Index Value | Syncfusion +description: Learn how to get the index value of a selected row cell in Blazor TreeGrid and use row and cell indexes for programmatic operations. +platform: Blazor +control: Tree Grid +documentation: ug +--- + +# Get Selected Row Cell Index Value in Blazor TreeGrid + +The index value of a selected row or cell in the Blazor TreeGrid component can be retrieved using the [GetSelectedRowCellIndexesAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_GetSelectedRowCellIndexesAsync) method of the TreeGrid component. + +The following example demonstrates how to use the [GetSelectedRowCellIndexesAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_GetSelectedRowCellIndexesAsync) method on a button click to return the selected row cell indexes. + +{% tabs %} + +{% highlight razor %} + +@using TreeGridComponent.Data; +@using Syncfusion.Blazor.Buttons; +@using Syncfusion.Blazor.Grids; +@using Syncfusion.Blazor.TreeGrid; + + + + + + + + + + + + + + +@code{ + SfTreeGrid TreeGrid; + + public List TreeGridData { get; set; } + + protected override void OnInitialized() + { + this.TreeGridData = TreeData.GetSelfDataSource().ToList(); + } + + public async Task SelectedRowCellIndex() + { + var value = await this.TreeGrid.GetSelectedRowCellIndexesAsync(); + } +} + +{% endhighlight %} + +{% highlight c# %} + +namespace TreeGridComponent.Data { + +public class TreeData + { + public int TaskId { get; set; } + public string TaskName { get; set; } + public int? Duration { get; set; } + public int? Progress { get; set; } + public string Priority { get; set; } + public int? ParentId { get; set; } + + public static List GetSelfDataSource() + { + List TreeDataCollection = new List(); + TreeDataCollection.Add(new TreeData() { TaskId = 1, TaskName = "Parent Task 1", Duration = 10, Progress = 70, Priority = "Critical", ParentId = null }); + TreeDataCollection.Add(new TreeData() { TaskId = 2, TaskName = "Child task 1", Progress = 80, Priority = "Low", Duration = 50, ParentId = 1 }); + TreeDataCollection.Add(new TreeData() { TaskId = 3, TaskName = "Child Task 2", Duration = 5, Progress = 65, Priority = "Critical", ParentId = 2 }); + TreeDataCollection.Add(new TreeData() { TaskId = 4, TaskName = "Child task 3", Duration = 6, Priority = "High", Progress = 77, ParentId = 3 }); + TreeDataCollection.Add(new TreeData() { TaskId = 5, TaskName = "Parent Task 2", Duration = 10, Progress = 70, Priority = "Critical", ParentId = null }); + TreeDataCollection.Add(new TreeData() { TaskId = 6, TaskName = "Child task 1", Duration = 4, Progress = 80, Priority = "Critical", ParentId = 5 }); + TreeDataCollection.Add(new TreeData() { TaskId = 7, TaskName = "Child Task 2", Duration = 5, Progress = 65, Priority = "Low", ParentId = 5 }); + TreeDataCollection.Add(new TreeData() { TaskId = 8, TaskName = "Child task 3", Duration = 6, Progress = 77, Priority = "High", ParentId = 5 }); + TreeDataCollection.Add(new TreeData() { TaskId = 9, TaskName = "Child task 4", Duration = 6, Progress = 77, Priority = "Low", ParentId = 5 }); + return TreeDataCollection; + } + } +} + +{% endhighlight %} + +{% endtabs %} + +> Note: To retrieve the row cell index value, the [Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridSelectionSettings.html#Syncfusion_Blazor_TreeGrid_TreeGridSelectionSettings_Mode) property of the [TreeGridSelectionSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridSelectionSettings.html) component must be set to **Cell**. diff --git a/grid-toc.html b/grid-toc.html index 78f1d484..783fcbca 100644 --- a/grid-toc.html +++ b/grid-toc.html @@ -1264,7 +1264,6 @@
  • Command Column Editing
  • Column Validation
  • Entity Framework
  • -
  • Auto Fill like Excel