@@ -21,6 +21,8 @@ Currently tested with Entity Framework versions 6.0.0 and 6.2.0 and Datatables v
2121
2222[ How to use with MVC 5] ( /resources/documentation/README.Mvc.md )
2323
24+ [ How to use with Web Api 2] ( /resources/documentation/README.WebAPI2.md )
25+
2426## How to use on the client side
2527For how to install the jQuery Datatables plugin refer to the official documentation [ here] ( https://datatables.net/manual/installation )
2628
@@ -36,15 +38,11 @@ In order to map the ajax response to the correct columns the columns property mu
3638 url: " path to the data source" ,
3739 type: ' POST'
3840 },
39- " language" : {
40- " search" : " " ,
41- " searchPlaceholder" : " Search..."
42- },
4341 " columns" : [
44- { " data" : " CustomerID" , " searchable " : false },
45- { " data" : " Person.FirstName" , " searchable " : true },
46- { " data" : " Person.LastName" , " searchable " : true },
47- { " data" : " Store.Name" , " searchable " : true },
42+ { " data" : " CustomerID" },
43+ { " data" : " Person.FirstName" },
44+ { " data" : " Person.LastName" },
45+ { " data" : " Store.Name" },
4846 ]
4947 });
5048```
@@ -71,97 +69,8 @@ The following custom filters are supported on the server side:
7169- ` lt ` : less than;
7270- ` lte ` : less than or equal;
7371- ` eq ` : eqaul;
74- ##### Example:
75- ``` html
76- <div >
77- CreditRating: from <input type =" number" id =" minCreditRating" value =" 1" class =" reload-table" />
78- to <input type =" number" id =" maxCreditRating" value =" 3" class =" reload-table" />
79- </div >
80-
81- <div >
82- Business Entity ID = <input type =" number" id =" businessEntityId" value =" " class =" reload-table" />
83- </div >
84-
85- <div >
86- Modified Date = <input type =" date" id =" modifiedDate" value =" " class =" reload-table" />
87- </div >
88-
89- <div >
90- Account Number = <input type =" text" id =" accountNumber" value =" " class =" reload-table" />
91- </div >
92-
93- <table id =" SearchResultTable" class =" display" cellspacing =" 0" width =" 100" >
94- <thead >
95- <tr >
96- <th >BusinessEntityID</th >
97- <th >CreditRating</th >
98- <th >ActiveFlag</th >
99- <th >AccountNumber</th >
100- <th >ModifiedDate</th >
101- </tr >
102- </thead >
103- <tfoot >
104- <tr >
105- <th >BusinessEntityID</th >
106- <th >CreditRating</th >
107- <th >ActiveFlag</th >
108- <th >AccountNumber</th >
109- <th >ModifiedDate</th >
110- </tr >
111- </tfoot >
112- </table >
113-
114- @section Scripts {
115- <script >
116-
117-
118- var table = $ (' #SearchResultTable' ).DataTable ({
119- " proccessing" : true ,
120- " serverSide" : true ,
121- " ajax" : {
122- url: " @Url.Action(" GetVendorsData" , " Vendors" )" ,
123- type: ' POST' ,
124- " data " : function (d ) {
125- d .custom = {
126- " filters" : {
127- " CreditRating" : { " gte" : $ (' #minCreditRating' ).val (), " lte" : $ (' #maxCreditRating' ).val () },
128- " BusinessEntityID" : { " eq" : $ (' #businessEntityId' ).val () },
129- " ModifiedDate" : { " eq" : $ (' #modifiedDate' ).val () },
130- " AccountNumber" : { " eq" : $ (' #accountNumber' ).val () },
131- }
132- }
133- }
134- },
135- " language" : {
136- " search" : " " ,
137- " searchPlaceholder" : " Search..."
138- },
139- " columns" : [
140- { " data" : " BusinessEntityID" , searchable: false },
141- { " data" : " CreditRating" , searchable: false },
142- { " data" : " ActiveFlag" , " searchable" : false },
143- { " data" : " AccountNumber" , searchable: true },
144- { " data" : " ModifiedDate" , " searchable" : false },
145- ],
146- " columnDefs" : [
147- {
148- " render " : function (data , type , row ) {
149- date = new Date (parseInt (row .ModifiedDate .replace (" /Date(" , " " ).replace (" )/" , " " ), 10 ));
150-
151- return date .toLocaleDateString ();
152- },
153- " targets" : 4
154- }
155- ]
156-
157- });
158-
159- $ (' .reload-table' ).on (' change' , function () {
160- table .ajax .reload ();
161- });
162- </script >
163- }
164- ```
72+
73+ [ Custom filters example] ( /resources/documentation/example-custom-filters.md )
16574
16675#### Extensibility Points
16776You can insert custom logic at any point of the data processing pipe line. The following extensibility points are provided (in order of execution):
0 commit comments