Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Individual column filtering #7

Open
walliby opened this issue Sep 13, 2013 · 3 comments
Open

Individual column filtering #7

walliby opened this issue Sep 13, 2013 · 3 comments

Comments

@walliby
Copy link

walliby commented Sep 13, 2013

This may be more of a general datatables question but I am not finding any resolution in the datatables docs. I am not having any luck getting individual column filtering to work.

This works to filter the whole table...
$('select#association').change( function() { oTable.fnFilter( $(this).val()); } );

But this does not work to filter only my 2nd column...
$('select#association').change( function() { oTable.fnFilter( $(this).val(), 1); } );

@cnizzardini
Copy link
Owner

Try asking the datatables forum: https://datatables.net/forums/

@walliby
Copy link
Author

walliby commented Sep 14, 2013

Following up on the individual column filtering, I had to add any $_GET['sSearch_colnum'] to my paginate conditions. Any thoughts on adding support for individual column filtering in the component? Below is how datatables implemented it in straight PHP...

/* Individual column filtering */
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
    if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
    {
        if ( $sWhere == "" )
        {
            $sWhere = "WHERE ";
        }
        else
        {
            $sWhere .= " AND ";
        }
        $sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
    }
}

@cnizzardini cnizzardini reopened this Sep 14, 2013
@cnizzardini
Copy link
Owner

Will do at some point. Feel free to add it yourself and if it works I can add it into the code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants