When I open the page first time, it shows the results fine but when I use filtering or ordering a column etc. ajax method successfully returns the correct elements and json format looks correct but grid doesn't update the content. I initialized datatable in the following way:
$('#myDataTable').dataTable({
"sAjaxSource": '@Url.Action("_Index")',
"bServerSide": true,
"aoColumns": [
{ "sName": "Konu" },
{ "sName": "Şikayet" },
{ "sName": "Kullanıcı Adı" },
{ "sName": "Müşteri Adı" },
{ "sName": "Müşteri Soyadı" },
{ "sName": "Şirket Adı" },
{ "sName": "Cevaplandı" },
{
"sName": "Cevap Ver",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
return '<a href='+'@Url.Action("Edit")' + '/' +
oObj.aData[7] + '>Cevap Ver</a>';
}
}
]
});
And in serverside:
public ActionResult _Index(jQueryDataTableParamModel table)
{
var feedbacksList = (List<FeedbackAjaxVM>)AppService.QueryInfo("Admin", "GetFeedbackAjaxList", table);
IEnumerable<string[]> feedbacks = from c in feedbacksList
select new string[] {
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 = feedbacks
},JsonRequestBehavior.AllowGet);
}
I think my problem is about clientside code but couldn't figured that out.