Friday 15 March 2013

asp.net mvc - JQuery Datatables serverside proccessing table doesn't refresh the content -


When I open the page for the first time, this result shows fine, but when I filter or order a column etc. The AJAX method returns the right elements successfully and Jason's format looks correct but does not update the grid content. I started the dataset in the following manner:

  $ ('# myDataTable'). Detatebl ({ "sAjaxSource": '@ Url.Action ( "_node)", "bServerSide": true, "AO column": {{ "sName": "Konu"}, { "sName": "Ã… ?? ikayet "}, {" sName ":" Kulln ± CA ± Adu ± "}, {" sName ":" { "SName": "CevaplandÄ ±"}, { "S Annam"}, "", "{" SName " : "Cevap Ver", "bSearchable": false, "bSortable": false, "fnRender": function (oObj) {return '& lt; a href =' + '@ Url.Action ( "edit")' + '/' + Oobz. Etata [7] + '& gt; service version & lt; / a & gt;'}}}}});   

and serverside:

  public ActionResult _Index (jQueryDataTableParamModel table) {var feedbacksList = (List of & lt; FeedbackAjaxVM & gt;) AppService.QueryInfo ("Admin", "GetFeedbackAjaxList", Table); IEnumerable & LT; String []> Select feedbacksList new string Feedbacks = c [] {c.Subject, c.Text, c.Username, c.CustomerName, c.CustomerSurname, c.CustomerFirmname, c.Response, c.Id.ToString ()}; Return Json (new {sEcho = "1", iTotalRecords = feedbacksList.FirstOrDefault () = null feedbacksList.FirstOrDefault () TotalRecords:?. 0, iTotalDisplayRecords = table.iDisplayLength, aaData = feedback}, JsonRequestBehavior.AllowGet); }   

I think my problem is about the clientside code but could not put that out

itemprop = "text">

sEcho for data

is important. Because the calls are asynchronous, therefore the Datatables needs to know the order of the request, this order is protected by increasing the sEcho variable in each server call.

However, you are returning 1 as SEO all the time. According to Datatable , the data is completely render with sEcho 1, so it is not rendering your data. You should return the sEcho value from the jQueryDataTableParamModel . Just replace

 with  sEcho = "1"   

  sEcho = table.sEcho    

No comments:

Post a Comment