Skip to content

Commit 451b82c

Browse files
999170: updated corrections
1 parent ac93bef commit 451b82c

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

blazor/treegrid/graphql.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Bind GraphQL Data in Blazor TreeGrid | Syncfusion
3+
title: Bind GraphQL Adaptor in Blazor TreeGrid | Syncfusion
44
description: Learn how to bind data from a GraphQL API to the Syncfusion Blazor TreeGrid, including querying, mutation, and integration techniques.
55
platform: Blazor
66
control: TreeGrid
@@ -11,7 +11,7 @@ documentation: ug
1111

1212
GraphQL is a powerful query language for APIs, designed to provide a more efficient alternative to traditional REST APIs. It allows you to precisely fetch the data you need, reducing over-fetching and under-fetching of data. GraphQL provides a flexible and expressive syntax for querying, enabling clients to request only the specific data they require.
1313

14-
Syncfusion’s Blazor TreeGrid seamlessly integrates with GraphQL servers using the GraphQLAdaptor in the [SfDataManager](https://blazor.syncfusion.com/documentation/data/getting-started-with-web-app). This specialized adaptor simplifies the interaction between the TreeGrid and GraphQL servers, allowing efficient data retrieval with support for data operations like CRUD (Create, Read, Update and Delete), paging, sorting, and filtering.
14+
Syncfusion’s Blazor TreeGrid seamlessly integrates with GraphQL servers using the GraphQLAdaptor in the [`SfDataManager`](https://blazor.syncfusion.com/documentation/data/getting-started-with-web-app). This specialized adaptor simplifies the interaction between the TreeGrid and GraphQL servers, allowing efficient data retrieval with support for data operations like CRUD (Create, Read, Update and Delete), paging, sorting, and filtering.
1515

1616
This section describes a step-by-step process for retrieving data from a GraphQL service using GraphQLAdaptor, then binding it to the TreeGrid to facilitate data and CRUD operations.
1717

@@ -46,10 +46,10 @@ Install-Package HotChocolate.AspNetCore
4646

4747
**Step 3: Create a model class**
4848

49-
Add a new folder named **Models**. Then, add a model class named **OrderData.cs** in the **Models** folder to represent the order data.
49+
Add a new folder named **Models**. Then, add a model class named **EmployeeData.cs** in the **Models** folder to represent the employee data.
5050

5151
{% tabs %}
52-
{% highlight cs tabtitle="OrderData.cs" %}
52+
{% highlight cs tabtitle="EmployeeData.cs" %}
5353

5454
using System.Text.Json.Serialization;
5555

@@ -307,15 +307,15 @@ namespace GraphQLServer.Models
307307

308308
**Step 4: Define the GraphQL query**
309309

310-
Create a `GraphQLQuery` class to define the query resolver for fetching order data. This class will handle the logic for retrieving data from the `OrderData` model. The following code demonstrates the `DataManagerRequestInput` class, which is passed as an argument to the resolver function.
310+
Create a `GraphQLQuery` class to define the query resolver for fetching employee data. This class will handle the logic for retrieving data from the `EmployeeData` model. The following code demonstrates the `DataManagerRequestInput` class, which is passed as an argument to the resolver function.
311311

312312
{% tabs %}
313313
{% highlight cs tabtitle="GraphQLQuery.cs" %}
314314

315315
using GraphQLServer.Models;
316316

317317
/// <summary>
318-
/// Represents the GraphQL query resolver for fetching order data.
318+
/// Represents the GraphQL query resolver for fetching employee data.
319319
/// </summary>
320320
public class GraphQLQuery
321321
{
@@ -664,19 +664,24 @@ To verify that the GraphQL server is functioning correctly, use the following ex
664664

665665
```
666666
{
667-
ordersData {
668-
count
669-
result {
670-
orderID
671-
customerID
672-
shipCity
673-
shipCountry
674-
}
675-
}
667+
employeesData(dataManager: $dataManager) {
668+
count
669+
result {
670+
employeeID
671+
managerID
672+
hasChild
673+
name
674+
lastName
675+
title
676+
location
677+
dateJoined
678+
salaryPerMonth
679+
email
680+
}
676681
}
677682
```
678683

679-
This query will return the total count of orders and a list of order details. Ensure the server is running and accessible at `http://localhost:xxxx/graphql` before testing. Here, `xxxx` represents the port number.
684+
This query will return the total count of employee data. Ensure the server is running and accessible at `http://localhost:xxxx/graphql` before testing. Here, `xxxx` represents the port number.
680685

681686
For more details, refer to the [Hot Chocolate documentation](https://chillicream.com/docs/hotchocolate).
682687

@@ -3790,4 +3795,6 @@ namespace GraphQLServer.GraphQL
37903795
{% endhighlight %}
37913796
{% endtabs %}
37923797

3793-
![Crud Operation](./images/treegrid-graphql-CRUD.gif)
3798+
![Crud Operation](./images/treegrid-graphql-CRUD.gif)
3799+
3800+
You can get the entire code in the [github](https://github.com/SyncfusionExamples/Binding-data-from-remote-service-to-blazor-data-grid/tree/master/GraphQLAdaptor) sample.

0 commit comments

Comments
 (0)