Skip to content

Commit 89c0d1d

Browse files
authored
Merge pull request #6707 from syncfusion-content/983239-treegrid3
983239: data-binding, excel-export, exporting changed
2 parents 87269f9 + 654f8b7 commit 89c0d1d

File tree

5 files changed

+90
-88
lines changed

5 files changed

+90
-88
lines changed

blazor/treegrid/data-binding.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
22
layout: post
33
title: Data Binding in Blazor TreeGrid Component | Syncfusion
4-
description: Checkout and learn here all about Data Binding in Syncfusion Blazor TreeGrid component and much more.
4+
description: Learn how to bind data to Syncfusion Blazor TreeGrid using local lists, remote services, ObservableCollection and DynamicObject.
55
platform: Blazor
6-
control: Tree Grid
6+
control: TreeGrid
77
documentation: ug
88
---
99

1010
# Data Binding in Blazor TreeGrid Component
1111

12-
The Tree Grid uses **SfDataManager**, which supports both RESTful Web Services binding and List binding. The [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property can be assigned either using the **SfDataManager** as child component of the Tree Grid Blazor component or list of business objects.
12+
The TreeGrid uses **SfDataManager**, which supports both RESTful Web Services binding and List binding. The [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property can be assigned either using the **SfDataManager** as child component of the Tree +Grid Blazor component or list of business objects.
1313
It supports two kinds of data binding method:
1414
* List binding
1515
* Remote service binding
1616

17-
To learn about how to bind local or remote data to Tree Grid, check out this video:
17+
To learn about how to bind local or remote data to TreeGrid, check out this video:
1818

19-
{% youtube "https://www.youtube.com/watch?v=YgSRj7yTebI" %}
19+
{% youtube alt="Syncfusion Blazor TreeGrid Data Binding Tutorial" "https://www.youtube.com/watch?v=YgSRj7yTebI" %}
2020

2121
## List binding
2222

23-
In List binding, data source for rendering the Tree Grid component is retrieved from the same application locally.
23+
In List binding, data source for rendering the TreeGrid component is retrieved from the same application locally.
2424

25-
Two types of Data binding are possible with the Tree Grid component.
25+
Two types of Data binding are possible with the TreeGrid component.
2626

2727
* Self-Referential Data binding (Flat Data)
2828
* Hierarchical Data binding
@@ -33,7 +33,7 @@ For Hierarchy Data binding, the data-source should be assigned as an object arra
3333

3434
### Self-Referential data binding/Flat Data
3535

36-
Tree Grid is rendered from Self-Referential data structures by providing two fields, [IdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_IdMapping) field and [ParentIdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_ParentIdMapping) field.
36+
TreeGrid is rendered from Self-Referential data structures by providing two fields, [IdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_IdMapping) field and [ParentIdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_ParentIdMapping) field.
3737

3838
* [IdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_IdMapping): This field contains unique values used to identify nodes.
3939
* [ParentIdMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_ParentIdMapping): This field contains values that indicate parent nodes.
@@ -87,7 +87,7 @@ Tree Grid is rendered from Self-Referential data structures by providing two fie
8787

8888
The [ChildMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_ChildMapping) property is used to map the child records in hierarchy data source.
8989

90-
The following code example shows how to bind the hierarchical list data into the Tree Grid component.
90+
The following code example shows how to bind the hierarchical list data into the TreeGrid component.
9191

9292
```cshtml
9393
@@ -147,9 +147,9 @@ N> * ExpandCollapse State maintenance is not supported for Hierarchy Data.
147147

148148
### DynamicObject binding
149149

150-
Tree Grid is a generic component which is strongly bound to a model type. There are cases when the model type is unknown during compile type. In such cases the data can be bound to the tree grid as list of **DynamicObject**.
150+
TreeGrid is a generic component which is strongly bound to a model type. There are cases when the model type is unknown during compile type. In such cases the data can be bound to the TreeGrid as list of **DynamicObject**.
151151

152-
**DynamicObject** can be bound to tree grid by assigning to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. Tree Grid can also perform all kind of supported data operations and editing in DynamicObject.
152+
**DynamicObject** can be bound to TreeGrid by assigning to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. TreeGrid can also perform all kind of supported data operations and editing in DynamicObject.
153153

154154
N> The [GetDynamicMemberNames](https://learn.microsoft.com/en-us/dotnet/api/system.dynamic.dynamicobject.getdynamicmembernames?view=net-8.0) method of DynamicObject class must be overridden and return the property names to render and perform data operations, editing etc., while using DynamicObject.
155155

@@ -251,9 +251,9 @@ N> The [GetDynamicMemberNames](https://learn.microsoft.com/en-us/dotnet/api/syst
251251

252252
### ExpandoObject binding
253253

254-
Tree Grid is a generic component which is strongly bound to a model type. There are cases when the model type is unknown during compile type. In such cases bind data to the tree grid as list of ExpandoObject.
254+
TreeGrid is a generic component which is strongly bound to a model type. There are cases when the model type is unknown during compile type. In such cases bind data to the TreeGrid using a list of ExpandoObject.
255255

256-
ExpandoObject can be bound to Tree grid by assigning to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. Tree Grid can also perform all kind of supported data operations and editing in ExpandoObject.
256+
ExpandoObject can be bound to TreeGrid by assigning to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. TreeGrid can also perform all kind of supported data operations and editing in ExpandoObject.
257257

258258
```cshtml
259259
@@ -652,18 +652,18 @@ The following screenshot represents the TreeGrid with **Observable Collection**.
652652

653653
## Remote Service binding
654654

655-
To bind remote data to Tree Grid component, assign service data as an instance of **SfDataManager** to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. To interact with remote data source, provide the endpoint **url** and define the [HasChildMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_HasChildMapping) property of tree grid.
655+
To bind remote data to TreeGrid component, assign service data as an instance of **SfDataManager** to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_DataSource) property. To interact with remote data source, provide the endpoint **url** and define the [HasChildMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_HasChildMapping) property of TreeGrid.
656656

657657
The [HasChildMapping](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_HasChildMapping) property maps the field name in data source, that denotes whether current record holds any child records. This is useful internally to show expand icon while binding child data on demand.
658658

659-
The Tree Grid provides **Load on Demand** support for rendering remote data. The Load on demand is considered in Tree Grid for the following actions.
659+
The TreeGrid provides **Load on Demand** support for rendering remote data. The Load on demand is considered in TreeGrid for the following actions.
660660

661661
* Expanding root nodes.
662-
* Navigating pages, with paging enabled in Tree Grid.
662+
* Navigating pages, with paging enabled in TreeGrid.
663663

664664
When load on demand is enabled, all the root nodes are rendered in collapsed state at initial load.
665665

666-
When load on demand support is enabled in Tree Grid with paging, the current or active page’s root node alone will be rendered in collapsed state. On expanding the root node, the child nodes will be loaded from the remote server.
666+
When load on demand support is enabled in TreeGrid with paging, the current or active page’s root node alone will be rendered in collapsed state. On expanding the root node, the child nodes will be loaded from the remote server.
667667

668668
When a root node is expanded, its child nodes are rendered and are cached locally, such that on consecutive expand/collapse actions on root node, the child nodes are loaded from the cache instead from the remote server.
669669

@@ -834,11 +834,11 @@ public class SelfReferenceData
834834
N> * By default, **SfDataManager** uses **ODataAdaptor** for remote data-binding.
835835
<br/> * Based on the RESTful web services, set the corresponding adaptor to SfDataManager. Refer [here](https://ej2.syncfusion.com/documentation/data/adaptors) for more details.
836836
<br/> * Filtering and searching server-side data operations are not supported in load on demand.
837-
<br/> * Only Self-Referential type data is supported with remote data binding in tree grid
837+
<br/> * Only Self-Referential type data is supported with remote data binding in TreeGrid
838838
839-
### Offline mode
839+
### Enable Offline Mode for Remote Data
840840
841-
On remote data binding, all tree grid actions such as paging, loading child on-demand, will be processed on server-side. To avoid postback, set the tree grid to load all data on initialization and make the actions process in client-side. To enable this behavior, use the *offline* property of **SfDataManager**.
841+
On remote data binding, all TreeGrid actions such as paging, loading child on-demand, will be processed on server-side. To avoid postback, set the TreeGrid to load all data on initialization and make the actions process in client-side. To enable this behavior, use the *offline* property of **SfDataManager**.
842842
843843
```cshtml
844844

@@ -858,17 +858,17 @@ On remote data binding, all tree grid actions such as paging, loading child on-d
858858

859859
```
860860
861-
### LoadChildOnDemand
861+
### Load Child Records on Demand
862862
863-
The Tree Grid component provides an option to load child records on demand when using remote data binding by setting [LoadChildOnDemand](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_LoadChildOnDemand) to `true`.The behavior of the [LoadChildOnDemand](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_LoadChildOnDemand) feature of Tree Grid are described below.
863+
The TreeGrid component provides an option to load child records on demand when using remote data binding by setting [LoadChildOnDemand](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_LoadChildOnDemand) to `true`.The behavior of the [LoadChildOnDemand](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_LoadChildOnDemand) feature of TreeGrid are described below.
864864
865865
* The parent records are rendered in an **collapsed** state.
866866
867867
* Child records are loaded only when the corresponding parent records are **expanded**.
868868
869869
This feature is particularly useful for applications that have a large number of child records. If we want the child records to be readily accessible without additional user interaction for expanding nodes, we need to set **LoadChildOnDemand*** to **false**.
870870
871-
The following code example describes the behavior of the `LoadChildOnDemand` feature of Tree Grid.
871+
The following code example describes the behavior of the `LoadChildOnDemand` feature of TreeGrid.
872872
873873
{% tabs %}
874874
@@ -1118,7 +1118,7 @@ You can create your own adaptor by extending the built-in adaptors. The followin
11181118
11191119
### Sending additional parameters to the Rest Web Services
11201120
1121-
To add a custom parameter to the data request, use the **addParams** method of **Query**. Assign the **Query** object with additional parameters to the tree grid [Query](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_Query) property.
1121+
To add a custom parameter to the data request, use the **addParams** method of **Query**. Assign the **Query** object with additional parameters to the TreeGrid [Query](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_Query) property.
11221122
11231123
```cshtml
11241124

@@ -1163,19 +1163,19 @@ To add a custom parameter to the data request, use the **addParams** method of *
11631163
11641164
<!--Handling HTTP error
11651165
1166-
During server interaction from the tree grid, some server-side exceptions may occur, and you can acquire those error messages or exception details
1166+
During server interaction from the TreeGrid, some server-side exceptions may occur, and you can acquire those error messages or exception details
11671167
in the client-side using the [`ActionFailure`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_OnActionFailure) event.
11681168
11691169
The argument passed to the [`ActionFailure`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_OnActionFailure) event contains the error details returned from the server.
11701170
11711171
> The [`ActionFailure`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_OnActionFailure) event will be triggered not only for the server errors, but
1172-
also when there is an exception while processing the tree grid actions.
1172+
also when there is an exception while processing the TreeGrid actions.
11731173
11741174
-->
11751175
11761176
## Entity Framework
11771177
1178-
Follow the below steps to consume data from the **Entity Framework** in the Tree Grid component.
1178+
Follow the below steps to consume data from the **Entity Framework** in the TreeGrid component.
11791179
11801180
### Create DBContext class
11811181
@@ -1241,7 +1241,7 @@ namespace TreeGridWebApiEFSample.Shared.DataAccess
12411241
12421242
### Creating Web API Controller
12431243
1244-
A Web API Controller has to be created which allows Tree Grid directly to consume data from the Entity framework.
1244+
A Web API Controller has to be created which allows TreeGrid directly to consume data from the Entity framework.
12451245
12461246
```csharp
12471247
using System;
@@ -1311,9 +1311,9 @@ namespace TreeGridWebApiEFSample.Controllers
13111311
}
13121312
```
13131313
1314-
### Configure Tree Grid component using Web API adaptor
1314+
### Configure TreeGrid component using Web API adaptor
13151315
1316-
Now, the Tree Grid can be configured using the **'SfDataManager'** to interact with the created Web API and consume the data appropriately. To interact with web API, use WebApiAdaptor.
1316+
Now, the TreeGrid can be configured using the **'SfDataManager'** to interact with the created Web API and consume the data appropriately. To interact with web API, use WebApiAdaptor.
13171317
13181318
```cshtml
13191319
@using Syncfusion.Blazor.Grids
@@ -1342,6 +1342,6 @@ Now, the Tree Grid can be configured using the **'SfDataManager'** to interact w
13421342
}
13431343
```
13441344
1345-
To perform Tree Grid CRUD operation using Entity Framework. You can refer [here](https://blazor.syncfusion.com/documentation/treegrid/editing/entity-frame-work).
1345+
To perform TreeGrid CRUD operation using Entity Framework. You can refer [here](https://blazor.syncfusion.com/documentation/treegrid/editing/entity-frame-work).
13461346
13471347
N> You can find the fully working sample [here](https://github.com/SyncfusionExamples/Blazor-TreeGrid-With-EntityFramework).

blazor/treegrid/excel-export.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
---
22
layout: post
33
title: Excel Export in Blazor TreeGrid Component | Syncfusion
4-
description: Checkout and learn here all about excel export in Syncfusion Blazor TreeGrid component and much more.
4+
description: Learn how to export TreeGrid data to Excel in the Syncfusion Blazor TreeGrid component and much more.
55
platform: Blazor
6-
control: Tree Grid
6+
control: TreeGrid
77
documentation: ug
88
---
99

1010
# Excel Export in Blazor TreeGrid Component
1111

12-
The excel export allows exporting Tree Grid data to Excel document. Use the
13-
**ExportToExcelAsync** method for exporting. To enable Excel export in the Tree Grid, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_AllowExcelExport) property as true.
14-
15-
To know about exporting tree grid data to Excel document in Blazor tree grid component, you can check on this video.
12+
The Excel export feature allows exporting TreeGrid data to an Excel document using the **ExportToExcelAsync** method. To enable Excel export, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_AllowExcelExport) property to `true`.
1613

1714
{% youtube
1815
"youtube:https://www.youtube.com/watch?v=FNVCqLmaF1A"%}
@@ -96,7 +93,7 @@ public class TreeData
9693

9794
## To customize excel export
9895

99-
The excel export provides an option to customize mapping of the Tree Grid to excel document.
96+
The excel export provides an option to customize mapping of the TreeGrid to excel document.
10097

10198
### Export current page
10299

@@ -183,7 +180,7 @@ public class TreeData
183180

184181
### Export hidden columns
185182

186-
The excel export provides an option to export hidden columns of Tree Grid by defining **includeHiddenColumn** as **true**.
183+
The excel export provides an option to export hidden columns of TreeGrid by defining **includeHiddenColumn** as **true**.
187184

188185
{% tabs %}
189186

@@ -193,7 +190,7 @@ The excel export provides an option to export hidden columns of Tree Grid by def
193190
@using Syncfusion.Blazor.TreeGrid;
194191

195192
<SfTreeGrid @ref="TreeGrid" DataSource="@TreeGridData" AllowExcelExport="true" IdMapping="TaskId" ParentIdMapping="ParentId" TreeColumnIndex="1"
196-
Toolbar="@(new List<string>() { "ExcelExport" })">
193+
Toolbar="@(new List<string>() { "ExcelExport" })">
197194
<TreeGridEvents OnToolbarClick="ToolbarClickHandler" TValue="TreeData"></TreeGridEvents>
198195
<TreeGridColumns>
199196
<TreeGridColumn Field="TaskId" HeaderText="Task ID" Width="80" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
@@ -223,7 +220,7 @@ The excel export provides an option to export hidden columns of Tree Grid by def
223220
this.TreeGrid.ExportToExcelAsync(ExportProperties);
224221
}
225222
}
226-
}
223+
}
227224

228225

229226

@@ -529,4 +526,9 @@ public class TreeData
529526

530527
### Limitations
531528

532-
Microsoft Excel permits up to seven nested levels in outlines. So that in the Tree Grid we can able to provide only up to seven nested levels and if it exceeds more than seven levels then the document will be exported without outline option. Refer the [Microsoft Limitation](https://learn.microsoft.com/en-us/sql/reporting-services/report-builder/exporting-to-microsoft-excel-report-builder-and-ssrs?view=sql-server-2017#ExcelLimitations).
529+
## Limitations
530+
531+
Microsoft Excel supports up to **seven nested levels** in outlines. If the TreeGrid exceeds this depth, the document will be exported without outline formatting.
532+
533+
Refer to the official documentation:
534+
[Microsoft Limitation](https://learn.microsoft.com/en-us/sql/reporting-services/report-builder/exporting-to-microsoft-excel-report-builder-and-ssrs?view=sql-server-2017#ExcelLimitations).

0 commit comments

Comments
 (0)