I am using asp.net mvc5 and am trying to use djatery datatable server side data processing. Server-side processing tutorials show the format for returning the result from the server. But the difference in my project is that I cannot send a typed array for "data" from the server. I am sending all the text as a string with all the html tags. My data code is as below.
var e = t.DataTable({processing: true, serverSide: true, info: true, stateSave: true, PaginationType: "full_numbers", ajax:{ "url": '@Url.Action("AjaxGetJsonData","Define",new { tablename= @HttpContext.Current.Request.QueryString["tablename"] })', "type": "GET", "success": function (result) { console.log(result); $("#sample_1").find("tbody").html(result.data); $("#sample_1_processing").hide(); Init();
The ajax result is something like below
Object {draw: 1, iTotalRecords: 25000, iTotalDisplayRecords: 0, data: Array[1]}
the data is similar to
<tr><td></td><td></td><td></td><td></td></tr>
because the view is common to many tables, and there are many situations that I have to control. This way I use StringBuilder on the server side. If I put success on ajax, the pagination elements will disappear at the bottom of the data. Why can't success be used in ajax? I have all the features of a datatable in common and is there a way to set features like iTotalRecords manually? I know that there is no forum with dates here. I regret it, but I spent a lot of time and cannot find a solution. I want to handle all the datatable functions in ajax success manually. I am using the latest datatable.
source share