TypeError: f is undefined

TypeError: f is undefined

ThulasiramThulasiram Posts: 2Questions: 0Answers: 0

I am facing with javascript issue while trying to load the json data to datatable, below is the error which I am observing in the firebug ,

TypeError: f is undefined
...op!==""?Q(a.sAjaxDataProp)(c):c;for(b=0;b<f.length;b++)H(a,f[b]);a.iInitDisplayS...

Below is my code:

Js Code:

$('.sort_table').dataTable(
{
bPaginate: false,
bStateSave: false,
bSort: true,
bDestroy: true,
aoColumns: [ { data: "a" },
{ data: "b" },
{ data: "c" },
{ data: "d" },
{ data: "dt" }
],
sAjaxSource: $SCRIPT_ROOT + "/get_report/1"
} );

HTML Code:

<table class='sort_table'>
<thead>
<tr>
<th>Date</th>
<th>A Usage</th>
<th>B Size</th>
<th>C Size</th>
<th>D count</th>
</tr>
</thead>
<tbody>
</tbody>
</table>

Returning Json data from server:

  • Returning data by using json.dumps(data)

    {"23-Jun-2015": {"a": 3262.56, "b": 10268.22, "c": 2, "d": 6640.87, "dt": "23-Jun-2015"}}

I am new to jquery datatables, and tried my best to fix this issue but couldn't, Can anyone please help me on this...

Please let me know if you any questions or need any additional information from my end.

Thanks....

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    In future, per the forum rules, please link to a test case showing the issue.

    DataTables requires an array of items - one item for each row. It does not support objects as the collection.

    Allan

  • ThulasiramThulasiram Posts: 2Questions: 0Answers: 0

    Hi Allan,

    As I am new to this forum, I am not aware of the forum rule, Yeah, sure I'll follow the forum rules from next time. Thanks for providing the information related to my query....

This discussion has been closed.