Merge branch 'ent-12575-no-se-puede-ordenar-por-columnas-en-la-vista-de-dashboards' into 'develop'

Ent 12575 No se puede ordenar por columnas en la vista de Dashboards

See merge request artica/pandorafms!6756
This commit is contained in:
Rafael Ameijeiras 2024-01-19 08:37:12 +00:00
commit 3386347253
2 changed files with 20 additions and 3 deletions

View File

@ -41,7 +41,20 @@ if ($method === 'draw') {
$length = get_parameter('length', $config['block_size']);
$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'];
$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);
$count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where);
foreach ($dashboards as $dashboard) {

View File

@ -112,7 +112,11 @@ if (empty($dashboards) === true) {
'manageDashboards' => $manageDashboards,
],
'default_pagination' => $config['block_size'],
'no_sortable_columns' => [],
'no_sortable_columns' => [
4,
5,
6,
],
'order' => [
'field' => 'name',
'direction' => 'desc',