sAjaxSource - DataTables warning: table id=table1 - Requested unknown parameter '1' for row 0. For
sAjaxSource - DataTables warning: table id=table1 - Requested unknown parameter '1' for row 0. For
When using sAjaxSource, Below alert is witnessed and the entire table is displayed in first column. If i provide sEcho = 1, then data is displayed correctly but searching does not work. Please suggest a solution for this. Thank you!
Alert:
DataTables warning: table id=table1 - Requested unknown parameter '1' for row 0. For more information about this error, please see http://datatables.net/tn/4
JavaScript:
oTable = $('#table1').DataTable({
"bPaginate": false,
"bSort": false,
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": '@Url.Action("RefreshTable", "Sale")',
"bDeferRender": true
});
Controller:
public JsonResult RefreshTable(Sale param)
{
DataTable dt = new DataTable();
dt = sl.Select_mySales(User.Identity.Name);
var json = JsonConvert.SerializeObject(dt);
//return Json(new { aaData = json }, JsonRequestBehavior.AllowGet);
return Json(new
{
sEcho = param.sEcho, //communication b/w subsequent calls
iTotalRecords = 5,
iTotalDisplayRecords = 5,
aaData = json
},
JsonRequestBehavior.AllowGet);
}
View:
Call Date | Call Time | Order Number | Account Number | Telephone Number | Agent Name | Status | |
---|---|---|---|---|---|---|---|
@MySale.CallDate | @MySale.CallDate.ToString().Substring(MySale.CallDate.Length - 11) | @MySale.OrderNumber | @MySale.AccountNumber | @MySale.Tel | @MySale.AgentID | Hold | Edit @* Cancel Save*@ |