Using Angular Kendo Grid with Elastic Search and ASP.NET Core
There was a need for using a Kendo Grid in an Angular 5 website where the backing store for the data was Elastic Search. Utilizing the filtering on local data was simple enough but for the needs of filtering there needed to be server side integration. The server was running ASP.NET Core.
To get started create a view and view model for Angular to expose the grid.
https://gist.github.com/QiMata/ebaef2f9b6d7a27a88c4dbc3b808e964
To wire the view and view model to the server side data, there needs to be an Angular HTTP service and an ASP.NET Core Controller. The controller needs to be able to accept the filter and paging options of the grid as the user changes them and react to them server side. To accomplish this, some objects need to be created to handle the request:
First, the filter object, which is changed whenever a new filter is selected or is cleared; must be mapped to a C# object that can be serialized. The structure of the Kendo Grid filter is as such:
filter: {
logic: 'and',
filters: [{ field: 'ProductName', operator: 'contains', value: 'Chef' }]
}
To make that object transportable to C#, lets create a POCO:
https://gist.github.com/QiMata/8d22ed102ea119664d7aec6e1b913f45
Now lets create an ASP.NET Core controller endpoint for our Filter.
https://gist.github.com/QiMata/4b95bbb30c163fb00d3b1922d27acfd0
The only thing missing now is the query to work is the CompositeFilterMapper.
https://gist.github.com/QiMata/81e08d880401e0111b2c62415ed7e1cd
You will need to build in your own express and type mapping for properties, but otherwise this is built for Strings and DateTimes. From this base you should be able to implement different types and queries you would need for the Kendo Grid to work with ElasticSearch.
Using Angular Kendo Grid with Elastic Search and ASP.NET Core - How to Code .NET
[…] on August 19, 2018by admin submitted by /u/toothkiller [link] [comments] No comments […]
Dew Drop - August 21, 2018 (#2786) - Morning Dew
[…] Using Angular Kendo Grid with Elastic Search and ASP.NET Core (Jared Rhodes) […]
Dave
would be really really really nice if it compiled or at least enough info to make it compile.