Skip to content

Commit

Permalink
Revert "[ColsSelection] simplify + improve #74"
Browse files Browse the repository at this point in the history
This reverts commit 08389c4.
  • Loading branch information
SimonHeimberg committed Aug 21, 2018
1 parent ec536a7 commit 4b566c7
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/Resources/public/cubecommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,37 @@ if (typeof(cubetools) === 'undefined') {

var updateCols = function(table, hidableSettings)
{
var cols = table.find('td, th, col');
var cols = table.find('tr').eq(0).find('td, th');
cols.each(function () {
var colId = $(this).attr('id');
if (hidableSettings[colId]) {
updateOneCol(colId, hidableSettings[colId].hidden);
updateOneCol(hidableSettings[colId], hidableSettings[colId].hidden);
}
});
};

var updateOneCol = function(colId, hide)
var updateOneCol = function(colSettings, hide)
{
var cellsRule = columnStyle.cssRules.item(colSettings.ruleNo);
var colGroupRule = columnStyle.cssRules.item(colSettings.ruleNo + 1);
if (hide) {
$("." + colId).hide();
// for some browsers, it is enough to set collapse on col
colGroupRule.style.setProperty('visibility', 'collapse', 'important');
colGroupRule.style.setProperty('max-width', '0px', 'important');
// for the others, we set visibility and size 0 to the cells
cellsRule.style.setProperty('visibility', 'hidden', 'important');
cellsRule.style.setProperty('max-width', '0px', 'important');
cellsRule.style.setProperty('line-height', '0px', 'important');
cellsRule.style.setProperty('padding', '0px', 'important');
cellsRule.style.setProperty('overflow', 'hidden', 'important');
} else {
$("." + colId).show();
colGroupRule.style.visibility = '';
colGroupRule.style.setProperty('max-width', '');
cellsRule.style.visibility = '';
cellsRule.style.setProperty('max-width', '');
cellsRule.style.setProperty('line-height', '');
cellsRule.style.padding = '';
cellsRule.style.overflow = '';
}
};

Expand Down Expand Up @@ -242,7 +258,7 @@ if (typeof(cubetools) === 'undefined') {
var table = col.closest('table');
var id = table.find('.colsSelector').attr('id') || '';
var settings = cs.getHidableSettings(id);
updateOneCol(colId, hide);
updateOneCol(settings[colId], hide);
settings[colId].hidden = hide;
cs.saveHidableSettings(id, settings);
};
Expand Down

0 comments on commit 4b566c7

Please sign in to comment.