Skip to content

Commit

Permalink
Remove max-width from datatables (matomo-org#21056)
Browse files Browse the repository at this point in the history
  • Loading branch information
bx80 authored Jul 25, 2023
1 parent 1ccadfc commit c4eeee5
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions plugins/CoreHome/javascripts/dataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,49 +417,6 @@ $.extend(DataTable.prototype, UIControl.prototype, {
return parseInt(totalWidth, 10);
}

function setMaxTableWidthIfNeeded (domElem, maxTableWidth)
{
var $domElem = $(domElem);
var dataTableInCard = $domElem.parents('.card').first();
var parentDataTable = $domElem.parent('.dataTable');

if ($domElem.is('.dataTableVizEvolution,.dataTableVizStackedBarEvolution')) {
return; // don't resize evolution charts
}

dataTableInCard.width('');
$domElem.width('');
parentDataTable.width('');

var tableWidth = getTableWidth(domElem);

if (tableWidth <= maxTableWidth && tableWidth > 0) {
return;
}

if (self.isWidgetized() || self.isDashboard()) {
return;
}

if (dataTableInCard && dataTableInCard.length) {
// makes sure card has the same width
dataTableInCard.css('max-width', maxTableWidth);
} else {
$domElem.css('max-width', maxTableWidth);
}

if (parentDataTable && parentDataTable.length) {
// makes sure dataTableWrapper and DataTable has same size => makes sure maxLabelWidth does not get
// applied in getLabelWidth() since they will have the same size.

if (dataTableInCard.length) {
dataTableInCard.css('max-width', maxTableWidth);
} else {
parentDataTable.css('max-width', maxTableWidth);
}
}
}

function getLabelWidth(domElem, tableWidth, minLabelWidth, maxLabelWidth)
{
var labelWidth = minLabelWidth;
Expand Down Expand Up @@ -560,8 +517,6 @@ $.extend(DataTable.prototype, UIControl.prototype, {
return labelWidth - paddingLeft - paddingRight;
}

setMaxTableWidthIfNeeded(domElem, 1600);

var isTableVisualization = this.param.viewDataTable
&& typeof this.param.viewDataTable === 'string'
&& typeof this.param.viewDataTable.indexOf === 'function'
Expand Down

0 comments on commit c4eeee5

Please sign in to comment.