ethanbr - TableTools

ethanbr - TableTools

allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
edited October 2013 in General
@ethanbr: As noted in the "How are you using thread" it is absolutely not the place for questions. I've reported your question here. However, you don't include a link to a test case as requested in the forum rules.

As an aside, would another be able to help me with a problem since I'm really a newbie in this javascript coding. I would like to allow users to be able to print information contained in the tables, and I've tried in incorporate the TableTools script that includes the various save functions (CVS, Excel, PDF, Copy), but I can't seem to get it to work. I'd like to place it both at the top and bottom of the tables, like I have for the Search boxes. Here's the current setup:





/* Define two custom functions (asc and desc) for string sorting */
jQuery.fn.dataTableExt.oSort['string-case-asc'] = function(x,y) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};

jQuery.fn.dataTableExt.oSort['string-case-desc'] = function(x,y) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};

$(document).ready(function() {
/* Build the DataTable with third column using our custom sort functions */
$('#example').dataTable( {
"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"aaSorting": [ [0, 'asc'], [1, 'asc'] ],
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sType": 'string-case', "aTargets": [ 2 ] }
]
} );
} );



So, where do I insert the DataTables routine and the scripting to control for the placement of the buttons? I've tried the "T" function in the "sDom" control, and the oTools before the "aaSorting". Anyway, any help would be greatly appreciated, and apologies if this request appears imbecile.

Replies

  • ethanbrethanbr Posts: 2Questions: 0Answers: 0
    Hi Allan, sorry for the faux pas with regards to forum etiquette. I'll try not to let it happen again.

    So, with regards to the above problem, I currently have a table that works with pagination and a search field (both in the header and footer):

    http://letastevin.org/winetasting/winetable1.html


    I've tried in incorporate the TableTools script that includes the various save functions (CVS, Excel, PDF, Copy), but I can't seem to get it to work. I'd like to place it both at the top and bottom of the tables, like I have for the Search boxes. I've tried it with the following table, but it messes up all the formatting:

    http://letastevin.org/winetasting/winetable2.html

    Where am I going wrong here.
    Cheers, Ethan
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    If you look at the console in your browser you'll see:

    > ReferenceError: Can't find variable: ZeroClipboard_TableTools

    You need to include the ZeroClipboard file as well: https://github.com/DataTables/TableTools/tree/master/media/js

    Allan
This discussion has been closed.