Coder Social home page Coder Social logo

baltimorecounty / datatables.queryable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexanderkrutov/datatables.queryable

0.0 8.0 0.0 3.91 MB

.Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).

License: MIT License

C# 99.48% ASP 0.16% Batchfile 0.36%

datatables.queryable's Introduction

DataTables.Queryable

What is it?

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 significally reduces boilerplate code and helps to avoid writing same logic of parsing requests for different model types.

Installation NuGet Status

PM> Install-Package DataTables.Queryable

How to use it?

// 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.

How it works?

  1. DataTables.Queryable parses data from an incoming Http request and extracts related parameters (search text, columns ordering info, page number and number of records per page and etc.);
  2. Dynamically builds an expression tree from the request parameters and information about model type T using reflection;
  3. Filters provided IQueryable<T> with the expression tree.
  4. Returns query result as a PagedList<T> instance (collection of items that represents a single page of extracted data).

Take a closer look what happens inside.

Features

  • Global search, individual column search, ordering by one or many columns, pagination
  • Custom request parameters
  • Custom search predicates
  • Supports nested properties
  • Lazy data loading from provided IQueryable<T> (only filtered records will be extracted)
  • Compatible with Entity Framework

License

DataTables.Queryable is licensed under MIT license.

datatables.queryable's People

Contributors

alexanderkrutov avatar

Watchers

James Cloos avatar Marty Powell avatar  avatar  avatar  avatar  avatar Dan Fox avatar Jason Domasky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.