Individual Column Filter in 1.10
Individual Column Filter in 1.10
lyndonwil
Posts: 40Questions: 5Answers: 0
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
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
This discussion has been closed.
Replies
merci beaucoup
Allan
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'] ]);
}
}
Allan
"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
Allan
http://live.datatables.net/efuyaj/49/edit
Allan
"NetworkError: 404 Not Found - http://datatables.net/download/build/images/sort_desc.png"
"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"
Allan