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
Copy file name to clipboardexpand all lines: README.md
+15-1
Original file line number
Diff line number
Diff line change
@@ -152,15 +152,29 @@ To implement REST service that handles AJAX requests that JQuery DataTables send
152
152
Now you need to create async method that will serve JQuery DataTables AJAX requests with following classes:
153
153
- UriParser that will parse Http request parameters that JQuery DataTables component sends
154
154
- QueryBuilder that will create T-SQL query that will be executed.
155
+
155
156
First, you need to parse Request parameters using UriParser in order to extract the definition of query (QuerySpec object). Then you need to use QueryBuilder to create SQL query using the QuerySpec. Then you need to provide sql query to QueryPipe that will stream results to JQuery DataTables using Response.Body:
156
157
157
158
```
158
159
// GET api/People
159
160
[HttpGet]
160
-
public async Task Get()
161
+
public async Task Get(int draw, int start, int length)
161
162
{
162
163
var querySpec = JQueryDataTables.UriParser.Parse(tableSpec, this.Request);
163
164
var sql = QueryBuilder.Build(querySpec, tableSpec).AsJson();
[JQuery DataTables](https://datatables.net/) component requires AJAX response in some pre-defined format, so you woudl need to wrap results from database with header that contains number of total and number of filtered records.
0 commit comments