You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/treegrid/graphql.md
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
layout: post
3
-
title: Bind GraphQL Data in Blazor TreeGrid | Syncfusion
3
+
title: Bind GraphQL Adaptor in Blazor TreeGrid | Syncfusion
4
4
description: Learn how to bind data from a GraphQL API to the Syncfusion Blazor TreeGrid, including querying, mutation, and integration techniques.
5
5
platform: Blazor
6
6
control: TreeGrid
@@ -11,7 +11,7 @@ documentation: ug
11
11
12
12
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.
13
13
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.
15
15
16
16
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.
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.
311
311
312
312
{% tabs %}
313
313
{% highlight cs tabtitle="GraphQLQuery.cs" %}
314
314
315
315
using GraphQLServer.Models;
316
316
317
317
/// <summary>
318
-
/// Represents the GraphQL query resolver for fetching order data.
318
+
/// Represents the GraphQL query resolver for fetching employee data.
319
319
/// </summary>
320
320
public class GraphQLQuery
321
321
{
@@ -664,19 +664,24 @@ To verify that the GraphQL server is functioning correctly, use the following ex
664
664
665
665
```
666
666
{
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
+
}
676
681
}
677
682
```
678
683
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.
680
685
681
686
For more details, refer to the [Hot Chocolate documentation](https://chillicream.com/docs/hotchocolate).
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