#12575 fixed order columns in dashboard
This commit is contained in:
parent
f5a455aa15
commit
276cf73e49
|
@ -41,7 +41,20 @@ if ($method === 'draw') {
|
||||||
$length = get_parameter('length', $config['block_size']);
|
$length = get_parameter('length', $config['block_size']);
|
||||||
$orderBy = get_datatable_order(true);
|
$orderBy = get_datatable_order(true);
|
||||||
|
|
||||||
$sort_field = $orderBy['field'];
|
switch ($orderBy['field']) {
|
||||||
|
case 'groups':
|
||||||
|
$sort_field = 'nombre';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'favorite':
|
||||||
|
$sort_field = 'active';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sort_field = $orderBy['field'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$order = $orderBy['direction'];
|
$order = $orderBy['direction'];
|
||||||
|
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
|
@ -121,7 +134,7 @@ if ($method === 'draw') {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination;
|
$sql = 'SELECT * FROM tdashboard LEFT JOIN tgrupo ON tgrupo.id_grupo = tdashboard.id_group '.$where.' ORDER BY '.$sort_field.' '.$order.$pagination;
|
||||||
$dashboards = db_get_all_rows_sql($sql);
|
$dashboards = db_get_all_rows_sql($sql);
|
||||||
$count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where);
|
$count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where);
|
||||||
foreach ($dashboards as $dashboard) {
|
foreach ($dashboards as $dashboard) {
|
||||||
|
|
|
@ -112,7 +112,11 @@ if (empty($dashboards) === true) {
|
||||||
'manageDashboards' => $manageDashboards,
|
'manageDashboards' => $manageDashboards,
|
||||||
],
|
],
|
||||||
'default_pagination' => $config['block_size'],
|
'default_pagination' => $config['block_size'],
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
],
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => 'name',
|
'field' => 'name',
|
||||||
'direction' => 'desc',
|
'direction' => 'desc',
|
||||||
|
|
Loading…
Reference in New Issue