How to get the plug-in JS file?

How to get the plug-in JS file?

jerry98225jerry98225 Posts: 10Questions: 0Answers: 0
edited January 2012 in Plug-ins
Hi guys. Sorry for being a noob. I couldn't find the required JS file on this page http://datatables.net/plug-ins/ for plug-ins. Are they available to download on the site? On the sorting link, there is a JS file called "dataTables.numericComma.js". Anyone knows where to find it? Thanks.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    The sorting and API plug-ins aren't available as files for downloaded, you simply copy and paste the code from the page into your own JS file.

    In the case of the numeric comma sorting plug-in the code is here: http://datatables.net/plug-ins/sorting#numeric_comma . Just copy the code from the page and paste it into a new file. You can then call it whatever you want - dataTables.numericComma.js if you fancy it, or anything else!

    Allan
  • jerry98225jerry98225 Posts: 10Questions: 0Answers: 0
    Thanks for the help Allan.
  • rsuhartarsuharta Posts: 1Questions: 0Answers: 0
    do you have sample to use the script? I included in my page but nothing happened!

    jQuery.extend( jQuery.fn.dataTableExt.oSort, {
    "numeric-comma-pre": function ( a ) {
    var x = (a == "-") ? 0 : a.replace( /,/, "." );
    return parseFloat( x );
    },

    "numeric-comma-asc": function ( a, b ) {
    return ((a < b) ? -1 : ((a > b) ? 1 : 0));
    },

    "numeric-comma-desc": function ( a, b ) {
    return ((a < b) ? 1 : ((a > b) ? -1 : 0));
    }
    } );
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    You need to also set the sType for the column so that DataTables knows to use the plug-in (or use a suitable automatic type detection plug-in).

    Examples:
    http://datatables.net/release-datatables/examples/plug-ins/sorting_plugin.html
    http://datatables.net/release-datatables/examples/plug-ins/sorting_sType.html

    Allan
  • preeyankapreeyanka Posts: 2Questions: 0Answers: 0
    what is the aocolumns in the file for sorting? also, how to set the sType for the column
  • preeyankapreeyanka Posts: 2Questions: 0Answers: 0
    I get the javascript error as- TypeError: a.aoColumns[c] is undefined
  • hairlessmonkeyhairlessmonkey Posts: 1Questions: 0Answers: 0
    It would be very helpful to add to the directions on the plug-in api page that the source should be copy and pasted from the details below. I too wasted time searching the site and the downloaded source for the plug-in functions.
  • anurachianurachi Posts: 1Questions: 0Answers: 0
    Hi,
    After Downloading DataTables-1.9.4 file, i can see error in jquery.js,core.constructor.js files . please can anyone help me
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    What exactly is the problem? Link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
This discussion has been closed.