mRender gives error
mRender gives error
Dor
Posts: 2Questions: 0Answers: 0
Hey
This is my code in Twig using datatables.
It works only if one line is commented as below (twig comment {# ... #} )
[code]
"bProcessing": true,"bServerSide": true,
"sAjaxSource": "{{ path('table_data') }}",
"aoColumnDefs": [
{
"aTargets": [ 0 ],
"mData": "document.documentNumber"
}
,{
{# "mRender": function ( data, type, row ) { return data; },#}
"aTargets": [ 1 ],
"mData": "document.netSum"
}
,{
"aTargets": [ 2 ],
"mData": "document.grossSum"
}
],
[/code]
If I uncomment this line:
[code]
{# "mRender": function ( data, type, row ) { return data; },#}
[/code]
It gives me this error:
[quote]
DataTables warning (table id = 'DataTables_Table_0'): Requested unknown parameter '1' from the data source for row 0
[/quote]
I have no idea why this fails, I tried to follow mRender documentation from here http://datatables.net/usage/columns
On this stage, I would like to print whatever in mRender function, this "data" is just an example.
PS: I don't know if its important, but I use datatables indirectly by CSS template http://themeforest.net/item/melon-flat-responsive-admin-template/5495486
This is my code in Twig using datatables.
It works only if one line is commented as below (twig comment {# ... #} )
[code]
"bProcessing": true,"bServerSide": true,
"sAjaxSource": "{{ path('table_data') }}",
"aoColumnDefs": [
{
"aTargets": [ 0 ],
"mData": "document.documentNumber"
}
,{
{# "mRender": function ( data, type, row ) { return data; },#}
"aTargets": [ 1 ],
"mData": "document.netSum"
}
,{
"aTargets": [ 2 ],
"mData": "document.grossSum"
}
],
[/code]
If I uncomment this line:
[code]
{# "mRender": function ( data, type, row ) { return data; },#}
[/code]
It gives me this error:
[quote]
DataTables warning (table id = 'DataTables_Table_0'): Requested unknown parameter '1' from the data source for row 0
[/quote]
I have no idea why this fails, I tried to follow mRender documentation from here http://datatables.net/usage/columns
On this stage, I would like to print whatever in mRender function, this "data" is just an example.
PS: I don't know if its important, but I use datatables indirectly by CSS template http://themeforest.net/item/melon-flat-responsive-admin-template/5495486
This discussion has been closed.
Replies
Allan