Blazor SERVER CRUD sample with datagrid

hello,
i need some help to setup a sample blazor server app (.net 5, entity framework core,Syncfusion datagrid. 
What about connecting data to the grid. Do you suggest WebApi? to connect data.
it has Contacts,Notes, Tags,Templates
Contact can have many Notes (one to many relationship)
Contact can have Tags (many to many)

Is it possible to provide a working sample on the attached project?
 datagrid must do:filtering,searching,sorting,grouping,paging


Attachment: QuickNotesApp_cb9f8c2f.zip

5 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team March 11, 2021 01:38 PM UTC

Hi Dan, 

Greetings from Syncfusion support. 

Query 1 : Contact can have many Notes (one to many relationship) Contact can have Tags (many to many) 
We have validated your query and you want to perform DataOperations in a column with one to many relationship data in Grid column. Currently we don’t have support for this feature. Already, we have already considered to implement this feature “Provide data operation for one to many relationship columns” request, and added this to our feature request list. Based on specific parameters including product vision and technological feasibility we will implement this feature. This will be available in any of our upcoming releases.     
 
You can also communicate with us regarding the open features any time using our above Feature Report page or reopen the incident.  

Query 2 : What about connecting data to the grid. Do you suggest WebApi? to connect data. 
We suggest you to refer to our below documentation reference links for more details regarding the available Adaptors and the ways of binding data to Grid. You can use any of the available ways of data binding to bind data to Grid based on your scenario. 
References :  

Please get back to us if you need further assistance. 

Regards, 
Renjith R 



DA DAN March 11, 2021 02:25 PM UTC

as requested, can  you please make us a small working sample which is attached ? can you please use webapi ,and the datagrid to have all the capabilities filtering,searching,sorting,grouping paging ?

thanks 


RS Renjith Singh Rajendran Syncfusion Team March 12, 2021 10:36 AM UTC

Hi Dan, 

We tried adding our Grid and WebAPI controller codes in your shared application. But we could not access the DB in your shared application. Please refer the screenshot below, 

 

So, we have created a sample with our own DB to render Grid with WebAPI and handling the data operations. Please download the sample from the link below, 
Note : A local MDF file is used in the above sample to assign and process the data. So before running the sample, please make sure the connection for this file is established and the correct connection string(local path of the MDF file in your machine) is provided in OrderContext.cs file in the application. 
 
When using the WebAPI services, you need to handle these data operation actions at controller side based on the “Request.Query” you get from the request, just like the paging code we have handled in Get method of documentation using $skip and $top.  

So, we suggest you to ensure to handle the filter/sorting in the HttpGet method of corresponding controller page, based on the “Request.Query” you get from the request. Please refer the codes below, 

 
[DefaultController.cs] 
 
        [HttpGet] 
        public object Get() 
        { 
            try 
            { 
                Microsoft.AspNetCore.Http.IQueryCollection queryString = Request.Query; 
                ...  
                StringValues sSkip, sTake, sFilter, sSort; 
                 
                int skip = (queryString.TryGetValue("$skip", out sSkip)) ? Convert.ToInt32(sSkip[0]) : 0;   //paging query   
                int top = (queryString.TryGetValue("$top", out sTake)) ? Convert.ToInt32(sTake[0]) : countAll; 
                string filter = (queryString.TryGetValue("$filter", out sFilter)) ? sFilter[0] : null;    //filter or search query 
                string sort = (queryString.TryGetValue("$orderby", out sSort)) ? sSort[0] : null;         //sort query 
                ... 
        } 

 
We suggest you to refer the above attached sample and handle your application’s controller page based on the above suggestions and sample. 

Regards, 
Renjith Singh Rajendran 



Marked as answer

SB Shay Berger August 1, 2021 05:17 PM UTC

Hi Syncfusion Team,

Many thanks for the sample (EFGridFilterSort-1775235179). It was very helpful.

I have an issue using GetExpressionFilter with long variables. I had to add additional 'else if' in the method.


I will help if you share also a sample controller for WebApiAdaptor for using multi-selected delete [HttpDelete] and batch edit [HttpPut]


Thanks

Shay B.



RS Renjith Singh Rajendran Syncfusion Team August 2, 2021 01:07 PM UTC

Hi Shay, 

Greetings from Syncfusion support. 

When performing batch edit or multi row delete, the batch request will be send along with selected records. But unfortunately the ASP.NET Core Web API with batch is not yet supported by ASP.NET Core v3+. Hence it is not feasible from us to support batch edit or multi-delete with Web API, until ASP.NET Core provide the support for the proper batch handler.  

Please find the general GitHub link below. 

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon