You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the `[JQDataTable]` attribute to the ajax controller action. Return 'View(data)' where 'data' is of type IQueryable<>. On the client side configure the table for server side processing acccording to the jQuery Data Tables documentation https://datatables.net/examples/data_sources/server_side.html.
Copy file name to clipboardExpand all lines: README.md
+140Lines changed: 140 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,3 +11,143 @@ Supports:
11
11
Currently tested with Entity Framework versions 6.0.0 and 6.2.0 and Datatables version 1.10.16.
12
12
13
13
[How to use with MVC 5](https://github.com/VladimirDimov/jQuery-Datatables-Server-Side-Processing/blob/master/README.Mvc.md)
14
+
15
+
## How to use on the client side
16
+
To use it on the client side the jquery datatables library must be loaded on the browser. Follow the official jQuery Datatables guide for serverside processing [here](https://datatables.net/examples/data_sources/server_side.html).
17
+
18
+
In order to map the ajax response to the correct columns the columns property must be configure in the configuration object.
19
+
### Example:
20
+
```js
21
+
var table =$('table').DataTable({
22
+
"proccessing":true,
23
+
"serverSide":true,
24
+
"ajax": {
25
+
url:"path to the data source",
26
+
type:'POST'
27
+
},
28
+
"language": {
29
+
"search":"",
30
+
"searchPlaceholder":"Search..."
31
+
},
32
+
"columns": [
33
+
{ "data":"CustomerID", "searchable":false },
34
+
{ "data":"Person.FirstName", "searchable":true },
35
+
{ "data":"Person.LastName", "searchable":true },
36
+
{ "data":"Store.Name", "searchable":true },
37
+
]
38
+
});
39
+
```
40
+
41
+
#### Searching
42
+
Read how to use on the client side from [here](https://datatables.net/reference/option/searching)
43
+
44
+
The searching is performed only on string columns. Therefore the searchable parameter inside the columns property must be set to false. Only the string columns with the searchable parameter set to true will be included in the search.
45
+
46
+
#### Individual column filtering
47
+
Read how to use on the client side from [here](https://datatables.net/examples/api/multi_filter.html).
48
+
49
+
For all string columns the individual column filter will work as case insensitive search. For other types it will match the exact value. For DateTime types it will match the value with precision to the seconds.
50
+
51
+
#### Nested objects
52
+
Read how to use on the client side from [here](https://datatables.net/examples/ajax/deep.html).
53
+
54
+
#### Custom filters
55
+
To use the predefined custom filters the data property of the configuration object must be configured properly [link](https://datatables.net/reference/option/ajax.data).
56
+
57
+
The following custom filters are supported on the server side:
58
+
-`gt` : greater than;
59
+
-`gte` : greater than or equal;
60
+
-`lt` : less than;
61
+
-`lte` : less than or equal;
62
+
-`eq` : eqaul;
63
+
##### Example:
64
+
```html
65
+
<div>
66
+
CreditRating: from <inputtype="number"id="minCreditRating"value="1"class="reload-table" />
67
+
to <inputtype="number"id="maxCreditRating"value="3"class="reload-table" />
68
+
</div>
69
+
70
+
<div>
71
+
Business Entity ID = <inputtype="number"id="businessEntityId"value=""class="reload-table" />
72
+
</div>
73
+
74
+
<div>
75
+
Modified Date = <inputtype="date"id="modifiedDate"value=""class="reload-table" />
76
+
</div>
77
+
78
+
<div>
79
+
Account Number = <inputtype="text"id="accountNumber"value=""class="reload-table" />
0 commit comments