mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-28 10:24:10 +01:00
Added code to deal with empty db and dt column
Modified pluck method to skip column with empty db and map correct array for filter to be effective Modified data_output for better process of column with empty db Modified filter to skip empty db column
This commit is contained in:
parent
560dde4217
commit
cedb9e2ada
@ -1 +1 @@
|
||||
941a2f037381bcd19e64f08c1bb766fc20497373
|
||||
97d41b28a1b7e532890118dbca13a745e894fb27
|
||||
|
@ -43,10 +43,20 @@ class SSP {
|
||||
|
||||
// Is there a formatter?
|
||||
if ( isset( $column['formatter'] ) ) {
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
if(empty($column['db'])){
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i] );
|
||||
}
|
||||
else{
|
||||
$row[ $column['dt'] ] = $column['formatter']( $data[$i][ $column['db'] ], $data[$i] );
|
||||
}
|
||||
}
|
||||
else {
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
if(!empty($column['db'])){
|
||||
$row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
|
||||
}
|
||||
else{
|
||||
$row[ $column['dt'] ] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,8 +184,10 @@ class SSP {
|
||||
$column = $columns[ $columnIdx ];
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if(!empty($column['db'])){
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$globalSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,8 +203,10 @@ class SSP {
|
||||
|
||||
if ( $requestColumn['searchable'] == 'true' &&
|
||||
$str != '' ) {
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
if(!empty($column['db'])){
|
||||
$binding = self::bind( $bindings, '%'.$str.'%', PDO::PARAM_STR );
|
||||
$columnSearch[] = "`".$column['db']."` LIKE ".$binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -503,7 +517,12 @@ class SSP {
|
||||
$out = array();
|
||||
|
||||
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
|
||||
$out[] = $a[$i][$prop];
|
||||
if(empty($a[$i][$prop])){
|
||||
continue;
|
||||
}
|
||||
//removing the $out array index confuses the filter method in doing proper binding,
|
||||
//adding it ensures that the array data are mapped correctly
|
||||
$out[$i] = $a[$i][$prop];
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
Loading…
Reference in New Issue
Block a user