Uncaught SyntaxError: Unexpected string
Uncaught SyntaxError: Unexpected string
Hi All
Sorry, but I am very new to this and having great difficulty getting my head round it all.
I am trying to initialise a table and am getting Uncaught SyntaxError: Unexpected string after the line that starts "order:
it is probably some newbie silly mistake and for that I appologise, anyway, here is my code:
$(document).ready(function() {
$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "/DataTables/media/swf/copy_csv_xls_pdf.swf"
"order": [[7, "desc" ]]
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": "Save",
"aButtons": [ "csv", "xls", "pdf" ]
}
]
}
} );
} );
Thanks in advance, and please be gentle with me
Regards
Dave
This question has an accepted answers - jump to answer
Answers
I don't know where you're getting your code example(s) from, but basically from "order" onwards it's too much of a mess to explain simply.
I suggest you start again with the most rudimentary DataTables/TableTools example and work up from there.
http://datatables.net/extensions/tabletools/
Thanks tangerine
I got my code examples from this site!!
http://www.datatables.net/examples/basic_init/table_sorting.html
http://www.datatables.net/extensions/tabletools/buttons
http://www.datatables.net/release-datatables/extensions/TableTools/examples/swf_path.html
I need to be able to join them together as I cannot initialise the table more than once can I?
Regards
Dave
Start with this:
http://www.datatables.net/extensions/tabletools/buttons
and establish that it works.
Then insert
"order": [[ 3, "desc" ]] ,
after your "dom": line.Hi tangerine
Found one basic error on my part!!
I missed the , (comma) at the end of the line "order": [[ 3, "desc" ]] ,
I am still having a problem with setting the path to the Swf file using
"sSwfPath": "/DataTables/media/swf/copy_csv_xls_pdf.swf",
the path is still being seen as localhost/swf/copy_csv_xls_pdf.swf"
Thanks
Dave
Now sorted thank you. Basic error on my part!!