.Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).
It is a .Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).
The library significantly reduces boilerplate code and helps to avoid writing same logic of parsing requests for different model types.
PM> Install-Package DataTables.Queryable
// ASP.NET action handler inside a controller:
public JsonResult DataTablesRequestAction()
{
// make a DataTablesRequest object from the incoming Http query string
var request = new DataTablesRequest<Person>(Request.QueryString);
using (var ctx = new DatabaseContext())
{
// take persons from database, apply the DataTablesRequest filter and paginate
var persons = ctx.Persons.ToPagedList(request);
// push back a result in JSON form applicable for datatables.net
return JsonDataTable(persons);
}
}
Need more info? Welcome to the wiki.
T
using reflection;IQueryable<T>
with the expression tree.PagedList<T>
instance (collection of items that represents a single page of extracted data).Take a closer look what happens inside.
IQueryable<T>
(only filtered records will be extracted)DataTables.Queryable is licensed under MIT license.