Individual Column Filter in 1.10

Individual Column Filter in 1.10

lyndonwillyndonwil Posts: 40Questions: 5Answers: 0
edited March 2014 in DataTables 1.10
First off, i've just upgraded to v1.10 and wow... could things get any simpler ! Loving it :-)

I did just run into an issue though regarding individual column filtering. Basically, it wasn't working and i kept getting a full set of results back.

I had a good look through ssp.class.php and noticed something in the following section :

[code]
$where = '';

if ( count( $globalSearch ) ) {
$where = '('.implode(' OR ', $globalSearch).')';
}

if ( count( $columnSearch ) ) {
$where = $where === '' ?
implode(' AND ', $globalSearch) :
$where .' AND '. implode(' AND ', $globalSearch);
}

if ( $where !== '' ) {
$where = 'WHERE '.$where;
}

return $where;
[/code]

I assume that the columnsearch section could be using columnsearch and not globalsearch ? ie:

[code]


if ( count( $columnSearch ) ) {
$where = $where === '' ?
implode(' AND ', $columnSearch) :
$where .' AND '. implode(' AND ', $columnSearch);
}
[/code]

This change works for me, but i wanted to make sure it was a typo and not me breaking something further down the line !

Regards

Replies

  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    i have the same problem this solution is very good
    merci beaucoup
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup - very certainly a bug! I actually committed a fix for it a couple of days ago ( https://github.com/DataTables/DataTablesSrc/commit/5163edd378f ), but it isn't yet in a release package. I'm going to do an rc-1 of 1.10 (hopefully tomorrow) which will contain the fix. Thanks for brining this up!

    Allan
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    when data contains spécial french caracters ' èçàù...' the datatable return ' null '
    i changed ssp.class.php with utf8_encode( to return the spécial caracters in the datatable

    // Is there a formatter?
    // 28/03/2014 utf8_encode () for spécial character éàèù...
    if ( isset( $column['formatter'] ) ) {
    $row[ $column['dt'] ] = utf8_encode($column['formatter']( $data[$i][ $column['db'] ], $data[$i] ));
    }
    else {
    $row[ $column['dt'] ] = utf8_encode( $data[$i][ $columns[$j]['db'] ]);
    }
    }
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    My classes assume that all data and all communication between the client and server, and server and database is UTF8 and that the database is also UTF8. There should be no need for conversion between character sets in such a case. Obviously if your processing environment doesn't match that, then yes, you would need to convert the character sets as appropriate.

    Allan
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    my mysql datatabase is in utf8_general_ci
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    i have download the RC1 version and column filter not working
    "public/scripts/DataTables1.10.0-RC1/media/js/jquery.dataTables.min"
    when i load
    public/scripts/DataTables1.10.0-2/media/js/jquery.dataTables.min"
    the filtering is good
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    What column filter? Can you show me the Javascript code please - ideally with a test case.

    Allan
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    here an example
    http://live.datatables.net/efuyaj/49/edit
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Excellent - thanks for that. Allowed me to find and fix an issue wight he column selector in rc.1. I've committed the fix and it is now in the nightly: http://live.datatables.net/efuyaj/54/edit

    Allan
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    firebug give me this error when i ordering
    "NetworkError: 404 Not Found - http://datatables.net/download/build/images/sort_desc.png"
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    3 errors
    "NetworkError: 404 Not Found - http://datatables.net/download/build/images/sort_both.png"
    sort_both.png
    "NetworkError: 404 Not Found - http://datatables.net/download/build/images/sort_asc.png"
    sort_asc.png
    "NetworkError: 404 Not Found - http://datatables.net/download/build/images/sort_desc.png"
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup - the nightly version of the CSS doesn't have the images at the correct address. The nightly hosted on this server is for testing only - which is why the images aren't present - it encourage you to either use the CDN version or host your own.

    Allan
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    merci
This discussion has been closed.