ColumnFilter Plugin Help

ColumnFilter Plugin Help

Jagst3r21Jagst3r21 Posts: 14Questions: 0Answers: 0
edited December 2012 in Plug-ins
Hey again,

I am trying to add the columnFilter plugin and added it to my js file, but I keep getting a syntax error. Any ideas? http://jagst3r15.com/scholarships360/table-of-scholarships/

[code] jQuery(document).ready(function($) {
$('#scholarships').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 50,

} );
.columnFilter({
aoColumns: [ { type: "select", values: [ 'Gecko', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman'] },
{ type: "text" },
null,
{ type: "number" },
{ type: "select" }
]

});

} );[/code]

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    [code]
    } );
    .columnFilter({
    [/code]

    Remove the semi-colon. They are two separate commands at the moment.

    Allan
  • Jagst3r21Jagst3r21 Posts: 14Questions: 0Answers: 0
    Thanks for the help Allan, that worked. I am trying to sort the money amount like you told me (to filter the comma), but it does not seem to be working. Any ideas? Here is my code: [quote]jQuery(document).ready(function($) {
    $('#scholarships').dataTable( {
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "iDisplayLength": 50,

    } )
    .columnFilter({ sPlaceHolder: "head:after",
    aoColumns: [ { type: "text", },
    { type: "text" },
    null,
    null,
    ]

    });

    jQuery.extend( jQuery.fn.dataTableExt.oSort, {
    "formatted-num-pre": function ( a ) {
    a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
    return parseFloat( a );
    },

    "formatted-num-asc": function ( a, b ) {
    return a - b;
    },

    "formatted-num-desc": function ( a, b ) {
    return b - a;
    }
    } );

    } );[/quote]
  • Jagst3r21Jagst3r21 Posts: 14Questions: 0Answers: 0
    I think I read that this only works for two numbers, like 1,6 or 1,8 etc. Is this true?
  • Jagst3r21Jagst3r21 Posts: 14Questions: 0Answers: 0
    Any ideas?
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    You need to tell DataTables which column too use the `formatted-num` plug-in on: http://datatables.net/release-datatables/examples/plug-ins/sorting_sType.html
This discussion has been closed.