Custom filtering - range seach not work 2

Custom filtering - range seach not work 2

mrakashanimrakashani Posts: 2Questions: 0Answers: 0

Hello Dears
When I use this Code:

    $(document).ready(function() {
        var dt = $('#example').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax": "scripts/ids-objects.php",
            "columns": [ 
                {
                    "class":          "details-control",
                    "orderable":      false,
                    "data":           null,
                    "defaultContent": ""
                },
                { "data": "maskanID" },   //1
                { "data": "PlaceMap" },   //2
                { "data": "Position" },     //3
                { "data": "TotalPrice" },   //4
            ],
            "order": [[1, 'asc']]
        });

Not Work Range Filtering :

    $.fn.dataTable.ext.search.push(
        function( settings, data, dataIndex ) {

            var min = parseInt( $('#minprice').val(), 10);
            var max = parseInt( $('#maxprice').val(), 10);
            var tprice = parseFloat(data[4])|| 0;

            if ( (  isNaN( min ) && isNaN( max ) ) ||
                 (  isNaN( min ) && tprice <= max )||
                 ( min <= tprice && isNaN( max ) ) ||
                 ( min <= tprice && tprice <= max ) )
            {
                return true;
            }

            return false;
        }
    );

and This Code:

        $(document).ready(function() {
              $('#minprice, #maxprice').keyup( function() {
                dt.draw();
               } );
        } );        

and HTML COd is:

<div style="float:left;margin:5px;padding:5px;">
    <table border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>Min</td>
            <td><input type="text" id="minprice" name="minprice" size="12"></td>
        </tr>
        <tr>
            <td>Max</td>
            <td><input type="text" id="maxprice" name="maxprice" size="12"></td>
        </tr>
    </table>
</div>

PLEASE HELP ME PLEASEEEE

Replies

This discussion has been closed.