From 03a04c0442650307d3115f3bc9f869ccc771bb4b Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 28 Apr 2021 17:05:42 +0200 Subject: [PATCH] Improve Manage_Table : align column numeric to the right by default --- include/lib/manage_table_sql.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index 5b9ea64ef..ec897c60e 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -798,8 +798,11 @@ function check() if ( $key == $this->sort_column) { $sorted=' class="sorttable_sorted"'; } - if ($this->get_property_visible($key)==true) - echo th("",$sorted,$this->a_label_displaid[$key]); + + $style=($this->get_col_type($key)=="text")?"":' style="text-align:right;" '; + if ($this->get_property_visible($key)==true ) { + echo th("", $sorted.$style, $this->a_label_displaid[$key]); + } } if ($this->can_update_row() && $this->icon_mod=="right") { @@ -923,7 +926,7 @@ function check() if ( $this->get_col_type($v) == 'text') { echo td($p_row[$v],sprintf(' sort_value="X%s" ',$p_row[$v])); } elseif ( $this->get_col_type($v) == 'numeric') { - echo td($p_row[$v],sprintf(' sort_value="%s" ',$p_row[$v])); + echo td($p_row[$v],sprintf('class="num" sort_value="%s" ',$p_row[$v])); } else { echo td($p_row[$v],sprintf(' sort_value="X%s" ',$p_row[$v])); @@ -965,6 +968,9 @@ function check() // For custom col echo td($this->display_row_custom($v,$p_row[$v],$pk_id)); } + elseif ( $this->get_col_type($v)=="numeric") { + echo td($p_row[$v],' class="num" '); + } else { echo td($p_row[$v]); }