Data Tables example

With Custom & Range filter

HTML

<script src="http://cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>

    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
            <tr>
                <th>Header Col1</th>
                <th>Header Col2</th>
                <th>Header Col3</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Value11</td>
                <td>Value21</td>
                <td>Value31</td>
            </tr>
            <tr>
                <td>Value12</td>
                <td>Value22</td>
                <td>Value32</td>
            </tr>
            <tr>
                <td>Value13</td>
                <td>Value23</td>
                <td>Value33</td>
            </tr>
            <tr>
                <td>Value14</td>
                <td>Value24</td>
                <td>Value34</td>
            </tr>
            <tr>
                <td>Value15</td>
                <td>Value25</td>
                <td>Value35</td>
            </tr>
            <tr>
                <td>Value16</td>
                <td>Value26</td>
                <td>Value36</td>
            </tr>
            <tr>
                <td>Value17</td>
                <td>Value27</td>
                <td>Value37</td>
            </tr>
            <tr>
                <td>Value18</td>
                <td>Value28</td>
                <td>Value38</td>
            </tr>
            <tr>
                <td>Value19</td>
                <td>Value29</td>
                <td>Value39</td>
            </tr>
            <tr>
                <td>Value20</td>
                <td>Value30</td>
                <td>Value40</td>
            </tr>
            <tr>
                <td>Value21</td>
                <td>Value31</td>
                <td>Value41</td>
            </tr>
            <tr>
                <td>Value22</td>
                <td>Value32</td>
                <td>Value42</td>
            </tr>
            <tr>
           ...

CSS

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * General page setup
 */

#dt_example {

    font: 80%/1.45em"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;

    margin: 0;

    padding: 0;

    color: #333;

    background-color: #fff;

}

#dt_example #container {

    width: 800px;

    margin: 30px auto;

    padding: 0;

}

#dt_example #footer {

    margin: 50px auto 0 auto;

    padding: 0;

}

#dt_example #demo {

    margin: 30px auto 0 auto;

}

#dt_example .demo_jui {

    margin: 30px auto 0 auto;

}

#dt_example .big {

    font-size: 1.3em;

    font-weight: bold;

    line-height: 1.6em;

    color: #4E6CA3;

}

#dt_example .spacer {

    height: 20px;

    clear: both;

}

#dt_example .clear {

    clear: both;

}

#dt_example pre {

    padding: 15px;

    background-color: #F5F5F5;

    border: 1px solid #CCCCCC;

}

#dt_example h1 {

    margin-top: 2em;

    font-size: 1.3em;

    font-weight: normal;

    line-height: 1.6em;

    color: #4E6CA3;

    border-bottom: 1px solid #B0BED9;

    clear: both;

}

#dt_example h2 {

    font-size: 1.2em;

    font-weight: normal;

    line-height: 1.6em;

    color: #4E6CA3;

    clear: both;

}

#dt_example a {

    color: #0063DC;

    text-decoration: none;

}

#dt_example a:hover {

    text-decoration: underline;

}

#dt_example ul {

    color: #4E6CA3;

}

.css_right {

    float: right;

}

.css_left {

    float: left;

}

.demo_links {

    float: left;

    width: 50%;

    margin-bottom: 1em;

}

#demo_info {

    padding: 5px;

    border: 1px solid #B0BED9;

    height: 100px;

    width: 100%;

    overflow: auto;

}

#dt_example code {

    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;

    padding: 2px 4px !important;

    white-space: nowrap;

    font-size: 0.9em;

    color: #D14;

    background-color: #F7F7F9;

    border: 1px solid #E1E1E8;

    -webkit-border-radius: 3px;

    -moz-border-radius: 3px;

    border-radius:...

JavaScript

$(document).ready(function () {    
    $('#example').dataTable({
        "sDom": '<lf<t>ip>',
            "bScrollInfinite": false,
            "bScrollCollapse": false,
            "sScrollY": "150px"
    });
    var dataTableObj = $('#example').DataTable();
    $('#customSearch').on('keyup change', function () {
        dataTableObj.column(1).search(this.value).draw();
    });


    $(document).on('click', '#example tbody tr', function () {
        alert($(this).html());
        var dataTable = $('#example').dataTable();
        dataTable.fnDeleteRow($(this).get(0));
    });
    
    var table = $('#example').DataTable();
     
    // Event listener to the two range filtering inputs to redraw on input
    $('#min, #max').keyup( function() {
       
        table.draw();
    } );    
    
    
});

$.fn.dataTable.ext.search.push(    
    function( settings, data, dataIndex ) {
        
        var min = parseInt( $('#min').val(), 10 );
        var max = parseInt( $('#max').val(), 10 );
        var age = parseFloat(data[1].substring(5, 7)) || 0;
 
        if ( ( isNaN( min ) && isNaN( max ) ) ||
             ( isNaN( min ) && age <= max ) ||
             ( min <= age   && isNaN( max ) ) ||
             ( min <= age   && age <= max ) )
        {
            return true;
        }
        return false;
    }
);