Hello
We are using an igGrid with remote features (paging, sorting, filtering).How can I use the remote summary feature?
I enabled the Summary Feature like this:
GridSummaries summaries = new GridSummaries(); summaries.Type = OpType.Remote; gridModel.Features.Add(summaries)
Now, the Request.Query in the Controller now contains summary elements which I could use in server functions to provide the requested values. (e.g. [Summaries(Date:date), count,min,max])I use a JsonResponse to provide the grid with the current pages data and the total of records.
var response = new WrappedGridResponse(data, null); response.TotalRecordsCount = totalRecordsCount.Value;
How can I add summary results to the JsonResponse so the grid knows about the summary results?
Hello Manfred,
I am glad that you find my suggestion helpful!
Thank you for choosing Infragistics components!
RegardsViktor KombovEntry Level Software DeveloperInfragistics, Inc.
Hello Viktor
Thank you for the sample. It was very helpful.
I did not know that i have to put the summaries in the JsonResult's Metadata, Summaries.
I kind of missed that part in the docu.
I now use this approach to send paging and summary data to the grid:
public class JsonResultMetadata { public JsonResultMetadata() { Summaries = new Dictionary<string, object>(); } public Dictionary<string, object> Summaries { get; set; } }
JsonResult result = new JsonResult(new { Records = data, TotalRecordsCount = totalRecordsCount.HasValue ? totalRecordsCount.Value : data.Count(), Metadata = new JsonResultMetadata { Summaries = summaries } }); result.StatusCode = 200; result.SerializerSettings = new JsonSerializerOptions { PropertyNamingPolicy = null }; return result;
Where summaries is a dictionary with columnName as key and the summary class from your sample as value.
Regards
Thank you for your patience while I was looking into this matter for you.
I believe you will find the following documentation regarding the Remote Summaries feature of igGrid very helpful:
- API reference
- Online sample
- Handling Remote Summaries section of the Handling Remote Features Manually (igGrid) topic - this section will guide you through the process of configuring and handling remote Summaries.
Additionally, attached you will find a small sample, where is demonstrated how the Remote Summaries feature of igGrid can be implemented in an ASP.NET Core 6.0 MVC project. Please test it on your side and let me know whether you find it helpful.
Regards,Viktor KombovEntry Level Software DeveloperInfragistics, Inc.
igGridRemoteSummaries.zip
Thank you for posting in our community.
I am currently looking into this matter for you. I will keep you posted on my progress and I will get back to you as soon as possible with more information or questions for you.
Please feel free to continue sending updates to this case at any time.