Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery datatable columnfilter issues?

i am using jquery data table plugin. this datatable plugin again uses another plugin called datatable column filter.

Here is the link for column filter

http://jquery-datatables-column-filter.googlecode.com/svn/trunk/index.html

Problem:

Here in creating datagrid no problem. But Column filters are not created.

enter image description here

enter code here
<!doctype html>
<html>
<head>
    <title>jQuery datagrid</title>

    <script src="js/jquery.js"></script>
    <script src="js/jquery.dataTables.js"></script>
    <script src="js/jquery.dataTables.columnFilter.js"></script>

    <style type="text/css" title="currentStyle">
            @import "css/jquery.dataTables.css";
    </style>
</head>
<body>
<script>
// init code

    $(document).ready(function(){
    //create datatable
         $('#example2').dataTable({
                 bJQueryUI: true,
                 "sPaginationType": "full_numbers",
                  "aoColumns": [
                { "sTitle": "Engine" },
                { "sTitle": "Browser" },
                { "sTitle": "Platform" },
                { "sTitle": "Version", "sClass": "center" },
                { "sTitle": "Grade", "sClass": "center" },],
                "aaData": [
                /* Reduced data set */
                [ "Trident", "Internet Explorer 4.0", "Win 95+", 4, "X" ],
                [ "Trident", "Internet Explorer 5.0", "Win 95+", 5, "C" ],
                [ "Trident", "Internet Explorer 5.5", "Win 95+", 5.5, "A" ],
                [ "Trident", "Internet Explorer 6.0", "Win 98+", 6, "A" ],
                [ "Trident", "Internet Explorer 7.0", "Win XP SP2+", 7, "A" ],
                [ "Gecko", "Firefox 1.5", "Win 98+ / OSX.2+", 1.8, "A" ],
                [ "Gecko", "Firefox 2", "Win 98+ / OSX.2+", 1.8, "A" ],
                [ "Gecko", "Firefox 3", "Win 2k+ / OSX.3+", 1.9, "A" ],
                [ "Webkit", "Safari 1.2", "OSX.3", 125.5, "A" ],
                [ "Webkit", "Safari 1.3", "OSX.3", 312.8, "A" ],
                [ "Webkit", "Safari 2.0", "OSX.4+", 419.3, "A" ],
                [ "Webkit", "Safari 3.0", "OSX.4+", 522.1, "A" ]
            ],
    })
              .columnFilter({
                aoColumns: [ { type: "select", values: [ 'Gecko', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman']  },
                         { type: "text" },
                         null,
                         { type: "number" },
                         { type: "select", values: [ 'A', 'C', 'U', 'X']  }
                    ]

            });
    });//end of  ready

</script>

<table id="example2">
</table>
</body>
</html>

Any idea on this

like image 571
niran Avatar asked Nov 30 '25 12:11

niran


1 Answers

I was having the same problem, and, inspired by Jay Rizzi, I added an empty footer. This solved the problem:

<tfoot>
    <tr>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
    </tr>
</tfoot>

Apparently, if no tfoot section is declared, columnFilter() won't create one.

like image 99
Jean-François Beauchamp Avatar answered Dec 03 '25 04:12

Jean-François Beauchamp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!