/** * Tabledrag doesn't hide columns when fieldset is collapsed * @see: http://drupal.org/node/303189 * * Unter oben angegebener URL gibt es einen patch für core (d7). * Damit drupal nicht gepatcht werden muss wird die entsprechende js-Funktion * hiermit überschrieben. * * Hide the columns containing form elements according to the settings for * this tableDrag instance. */ Drupal.tableDrag.prototype.hideColumns = function(){ for (var group in this.tableSettings) { // Find the first field in this group. for (var d in this.tableSettings[group]) { var field = $('.' + this.tableSettings[group][d]['target'] + ':first', this.table); if (field.size() && this.tableSettings[group][d]['hidden']) { var hidden = this.tableSettings[group][d]['hidden']; var cell = field.parents('td:first'); break; } } // Hide the column containing this field. if (hidden && cell[0]) { // Add 1 to our indexes. The nth-child selector is 1 based, not 0 based. // Match immediate children of the parent element to allow nesting. var i = $('td', cell.parent()).index(cell.get(0)) + 1; $('> thead > tr, > tbody > tr, > tr', this.table).each(function(){ var row = $(this); var index = i; // Adjust the index to take into account colspans. row.children().each(function(n) { if (n < index) { index -= (this.colSpan && this.colSpan > 1) ? this.colSpan - 1 : 0; } }); if (index > 0) { cell = row.children(':nth-child(' + index + ')'); if (cell[0].colSpan > 1) { // If this cell has a colspan, simply reduce it. cell[0].colSpan = cell[0].colSpan - 1; } else { cell.css('display', 'none'); } } }); } } };