@@ -21,6 +21,8 @@ Currently tested with Entity Framework versions 6.0.0 and 6.2.0 and Datatables v
21
21
22
22
[ How to use with MVC 5] ( /resources/documentation/README.Mvc.md )
23
23
24
+ [ How to use with Web Api 2] ( /resources/documentation/README.WebAPI2.md )
25
+
24
26
## How to use on the client side
25
27
For how to install the jQuery Datatables plugin refer to the official documentation [ here] ( https://datatables.net/manual/installation )
26
28
@@ -36,15 +38,11 @@ In order to map the ajax response to the correct columns the columns property mu
36
38
url: " path to the data source" ,
37
39
type: ' POST'
38
40
},
39
- " language" : {
40
- " search" : " " ,
41
- " searchPlaceholder" : " Search..."
42
- },
43
41
" 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" },
48
46
]
49
47
});
50
48
```
@@ -71,97 +69,8 @@ The following custom filters are supported on the server side:
71
69
- ` lt ` : less than;
72
70
- ` lte ` : less than or equal;
73
71
- ` 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 )
165
74
166
75
#### Extensibility Points
167
76
You 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