Skip to content

Commit

Permalink
refs matomo-org#1816 align percentage values right
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Nov 21, 2013
1 parent bb310be commit d0d556d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions plugins/CoreHome/javascripts/dataTable.js
Expand Up @@ -1156,6 +1156,20 @@ $.extend(DataTable.prototype, UIControl.prototype, {
var table = $(this).closest('table');
var nthChild = $(this).parent('tr').children().index($(this));
var rows = $('tr', table);


var maxWidth = 0;
rows.find("td:nth-child(" + (nthChild + 1) + ") .value").each(function (index, element) {
var width = $(element).width();
if (width > maxWidth) {
maxWidth = width;
}
});
rows.find("td:nth-child(" + (nthChild + 1) + ") .value").each(function (index, element) {
$(element).css({width: maxWidth, display: 'inline-block'});
});

var rows = $('tr', table);
rows.find("td:nth-child(" + (nthChild + 1) + ")").addClass('highlight');
},
function() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/templates/_dataTableCell.twig
Expand Up @@ -14,7 +14,7 @@
<span class='label{% if row.getMetadata('is_aggregate') %} highlighted{% endif %}'
{% if properties is defined and properties.tooltip_metadata_name is not empty %}title="{{ row.getMetadata(properties.tooltip_metadata_name) }}"{% endif %}>
{%- if row.getMetadata('html_label_suffix') %}<span class='label-suffix'>{{ row.getMetadata('html_label_suffix') | raw }}</span>{% endif -%}
{% endif %}{% if row.getColumn(column) %}{{- row.getColumn(column)|raw -}}{% else %}-{% endif %}
{% endif %}<span class="value">{% if row.getColumn(column) %}{{- row.getColumn(column)|raw -}}{% else %}-{% endif %}</span>
{% if column=='label' %}</span>{% endif %}
{% if not row.getIdSubDataTable() and column=='label' and row.getMetadata('url') %}
</a>
Expand Down

0 comments on commit d0d556d

Please sign in to comment.