diff --git a/js/repeater-list.js b/js/repeater-list.js
index 8b4ac05f1..d3586a81b 100755
--- a/js/repeater-list.js
+++ b/js/repeater-list.js
@@ -79,7 +79,7 @@
$.fn.repeater.Constructor.prototype.list_setSelectedItems = function (items, force) {
var selectable = this.viewOptions.list_selectable;
var self = this;
- var data, i, $item, l;
+ var data, i, $item, length;
//this function is necessary because lint yells when a function is in a loop
function checkIfItemMatchesValue () {
@@ -113,14 +113,14 @@
}
if (force === true || selectable === 'multi') {
- l = items.length;
+ length = items.length;
} else if (selectable) {
- l = (items.length > 0) ? 1 : 0;
+ length = (items.length > 0) ? 1 : 0;
} else {
- l = 0;
+ length = 0;
}
- for (i = 0; i < l; i++) {
+ for (i = 0; i < length; i++) {
if (items[i].index !== undefined) {
$item = this.$canvas.find('.repeater-list table tbody tr:nth-child(' + (items[i].index + 1) + ')');
if ($item.length > 0) {
@@ -137,11 +137,10 @@
$.fn.repeater.Constructor.prototype.list_sizeHeadings = function () {
var $table = this.$element.find('.repeater-list table');
$table.find('thead th').each(function () {
- var $hr = $(this);
- var $heading = $hr.find('.repeater-list-heading');
- $heading.outerHeight($hr.outerHeight());
- // outerWidth isn't always appropriate or desirable. Allow an explicit value to be set if needed
- $heading.outerWidth($heading.data('forced-width') || $hr.outerWidth());
+ var $th = $(this);
+ var $heading = $th.find('.repeater-list-heading');
+ $heading.outerHeight($th.outerHeight());
+ $heading.outerWidth($heading.data('forced-width') || $th.outerWidth());
});
};
@@ -176,12 +175,7 @@
this.$canvas.addClass('frozen-enabled');
}
- this.$element.find('.repeater-list table.table-frozen tr').each(function (i, elem) {
- $(this).height($table.find('tr:eq(' + i + ')').height());
- });
-
- var columnWidth = $table.find('td:eq(0)').outerWidth();
- this.$element.find('.frozen-column-wrapper, .frozen-thead-wrapper').width(columnWidth);
+ this.list_sizeFrozenColumns();
$('.frozen-thead-wrapper .repeater-list-heading').on('click', function() {
var index = $(this).parent('th').index();
@@ -219,6 +213,7 @@
$wrapper.find('.frozen-column-wrapper').css('left', scrollLeft);
}
if (actionsEnabled && shouldScroll) {
+ $wrapper.find('.actions-thead-wrapper').css('right', -scrollLeft);
$wrapper.find('.actions-column-wrapper').css('right', -scrollLeft);
}
@@ -228,6 +223,7 @@
$wrapper.find('.frozen-column-wrapper').css('left', '0');
}
if (actionsEnabled) {
+ $wrapper.find('.actions-thead-wrapper').css('right', '0');
$wrapper.find('.actions-column-wrapper').css('right', '0');
}
}
@@ -236,28 +232,28 @@
$.fn.repeater.Constructor.prototype.list_createItemActions = function () {
var actionsHtml = '';
var self = this;
- var i, l;
+ var i, length;
var $table = this.$element.find('.repeater-list .repeater-list-wrapper > table');
var $actionsTable = this.$canvas.find('.table-actions');
- for (i = 0, l = this.viewOptions.list_actions.items.length; i < l; i++) {
+ for (i = 0, length = this.viewOptions.list_actions.items.length; i < length; i++) {
var action = this.viewOptions.list_actions.items[i];
var html = action.html;
actionsHtml += '
' + html + ' ';
}
+ var selectlist = '' +
+ '' +
+ ' ' +
+ ' ' +
+ '
';
+
if ($actionsTable.length < 1) {
- var selectlist = '' +
- '' +
- ' ' +
- ' ' +
- '
';
-
- // The width set here is overwritten in `list_sizeHeadings`. This is used for sizing the subsequent rows.
- var $actionsColumnWrapper = $('
').insertBefore($table);
+
+ var $actionsColumnWrapper = $('
').insertBefore($table);
var $actionsColumn = $table.clone().addClass('table-actions');
$actionsColumn.find('th:not(:last-child)').remove();
$actionsColumn.find('tr td:not(:last-child)').remove();
@@ -267,19 +263,10 @@
$actionsColumn.find('thead tr').html('' + selectlist + '
');
//disable the header dropdown until an item is selected
$actionsColumn.find('thead .btn').attr('disabled', 'disabled');
- } else {
- var labelText = this.viewOptions.list_actions.label || '';
-
- var $labelOverlay = $('' + labelText + '
');
-
- // repeater-list.less:302 has `margin-left: -9px;` which shifts this over and makes it not actually cover what it is supposed to cover. Make it wider to compensate.
- var negative_margin_accomodation = 9;
- $labelOverlay.data('forced-width', this.list_actions_width + negative_margin_accomodation);
-
- var $th = $('' + labelText + ' ');
- $th.append($labelOverlay);
-
- $actionsColumn.find('thead tr').addClass('empty-heading').html($th);
+ }
+ else {
+ var label = this.viewOptions.list_actions.label || 'a ';
+ $actionsColumn.find('thead tr').addClass('empty-heading').html(''+ label +''+ label +'
');
}
// Create Actions dropdown for each cell in actions table
@@ -295,11 +282,7 @@
this.$canvas.addClass('actions-enabled');
}
- this.$element.find('.repeater-list table.table-actions thead tr th').outerHeight($table.find('thead tr th').outerHeight());
- this.$element.find('.repeater-list table.table-actions tbody tr td:first-child').each(function (i, elem) {
- $(this).outerHeight($table.find('tbody tr:eq(' + i + ') td').outerHeight());
- });
-
+ this.list_sizeActionsTable();
//row level actions click
this.$element.find('.table-actions tbody .action-item').on('click', function(e) {
@@ -328,21 +311,6 @@
});
};
- /*
- * list_getActionItems
- *
- * Called when user clicks on an "action item".
- *
- * Object selected - object containing `actionName`, string value of the `data-action` attribute of the clicked
- * "action item", and `rows` Array of jQuery objects of selected rows
- * Object e - jQuery event of triggering event
- *
- * Calls implementor's clickAction function if provided. Passes `selectedObj`, `callback` and `e`.
- * Object selectedObj - Object containing jQuery object `item` for selected row, and Object `rowData` for
- * selected row's data-attributes, or Array of such Objects if multiple selections were made
- * Function callback - ¯\_(ツ)_/¯
- * Object e - jQuery event object representing the triggering event
- */
$.fn.repeater.Constructor.prototype.list_getActionItems = function (selected, e) {
var i;
var selectedObj = [];
@@ -367,22 +335,32 @@
};
$.fn.repeater.Constructor.prototype.list_sizeActionsTable = function () {
+ var $actionsTable = this.$element.find('.repeater-list table.table-actions');
+ var $actionsTableHeader = $actionsTable.find('thead tr th');
var $table = this.$element.find('.repeater-list-wrapper > table');
- var $actionsTableHeading = this.$element.find('.repeater-list-wrapper .actions-column-wrapper thead th .repeater-list-heading');
- $actionsTableHeading.outerHeight($table.find('thead th .repeater-list-heading').outerHeight());
- };
- $.fn.repeater.Constructor.prototype.list_frozenOptionsInitialize = function () {
- var self = this;
- var isFrozen = this.viewOptions.list_frozenColumns;
- var isActions = this.viewOptions.list_actions;
- var isMulti = this.viewOptions.list_selectable === 'multi';
+ $actionsTableHeader.outerHeight($table.find('thead tr th').outerHeight());
+ $actionsTableHeader.find('.repeater-list-heading').outerHeight($actionsTableHeader.outerHeight());
+ $actionsTable.find('tbody tr td:first-child').each(function (i, elem) {
+ $(this).outerHeight($table.find('tbody tr:eq(' + i + ') td').outerHeight());
+ });
+ };
- var $checkboxes = this.$element.find('.frozen-column-wrapper .checkbox-inline');
+ $.fn.repeater.Constructor.prototype.list_sizeFrozenColumns = function () {
+ var $table = this.$element.find('.repeater-list .repeater-list-wrapper > table');
- var $everyTable = this.$element.find('.repeater-list table');
+ this.$element.find('.repeater-list table.table-frozen tr').each(function (i) {
+ $(this).height($table.find('tr:eq(' + i + ')').height());
+ });
+ var columnWidth = $table.find('td:eq(0)').outerWidth();
+ this.$element.find('.frozen-column-wrapper, .frozen-thead-wrapper').width(columnWidth);
+ };
+ $.fn.repeater.Constructor.prototype.list_frozenOptionsInitialize = function () {
+ var $checkboxes = this.$element.find('.frozen-column-wrapper .checkbox-inline');
+ var $everyTable = this.$element.find('.repeater-list table');
+ var self = this;
//Make sure if row is hovered that it is shown in frozen column as well
this.$element.find('tr.selectable').on('mouseover mouseleave', function(e) {
@@ -451,17 +429,21 @@
initialize: function (helpers, callback) {
this.list_sortDirection = null;
this.list_sortProperty = null;
+ this.list_specialBrowserClass = specialBrowserClass();
this.list_actions_width = (this.viewOptions.list_actions.width !== undefined) ? this.viewOptions.list_actions.width : 37;
this.list_noItems = false;
callback();
},
resize: function () {
- if (this.viewOptions.list_frozenColumns || this.viewOptions.list_actions){
- this.render();
- }else{
- if (this.viewOptions.list_columnSyncing) {
- this.list_sizeHeadings();
- }
+ sizeColumns.call(this, this.$element.find('.repeater-list-wrapper > table thead tr'));
+ if (this.viewOptions.list_actions) {
+ this.list_sizeActionsTable();
+ }
+ if (this.viewOptions.list_frozenColumns || this.viewOptions.list_selectable === 'multi') {
+ this.list_sizeFrozenColumns();
+ }
+ if (this.viewOptions.list_columnSyncing) {
+ this.list_sizeHeadings();
}
},
selected: function () {
@@ -482,7 +464,7 @@
var $table;
if ($listContainer.length < 1) {
- $listContainer = $('');
+ $listContainer = $('');
$listContainer.find('.repeater-list-wrapper').on('scroll.fu.repeaterList', function () {
if (self.viewOptions.list_columnSyncing) {
self.list_positionHeadings();
@@ -505,7 +487,7 @@
return false;
},
renderItem: function(helpers){
- renderRow.call(this, helpers.container, helpers.subset[helpers.index], helpers.index);
+ renderRow.call(this, helpers.container, helpers.subset, helpers.index);
return false;
},
after: function(){
@@ -541,184 +523,165 @@
}
//ADDITIONAL METHODS
- function renderColumn ($tr, row, rowIndex, column) {
- var content = row[column.property];
- var $col = $(' ');
+ var areDifferentColumns = function areDifferentColumns (oldCols, newCols) {
+ if (!newCols) {
+ return false;
+ }
+ if (!oldCols || (newCols.length !== oldCols.length)) {
+ return true;
+ }
+ for (var i = 0; i < newCols.length; i++) {
+ if (!oldCols[i]) {
+ return true;
+ } else {
+ for (var j in newCols[i]) {
+ if (oldCols[i][j] !== newCols[i][j]) {
+ return true;
+ }
- $col.addClass(column.className);
+ }
+ }
- if(this.viewOptions.list_actions !== false && column.property === '@_ACTIONS_@'){
- $col.addClass('repeater-list-actions-placeholder-column');
- content = '';
}
+ return false;
+ };
- content = (content !== undefined) ? content : '';
- $col.append(content);
+ function renderColumn ($row, rows, rowIndex, columns, columnIndex) {
+ var className = columns[columnIndex].className;
+ var content = rows[rowIndex][columns[columnIndex].property];
+ var $col = $(' ');
+ var width = columns[columnIndex]._auto_width;
- // excludes checkbox and actions columns, as well as columns with user set widths
- if (column._auto_width !== undefined) {
- $col.outerWidth(column._auto_width);
+ var property = columns[columnIndex].property;
+ if(this.viewOptions.list_actions !== false && property === '@_ACTIONS_@'){
+ content = '
';
}
- $tr.append($col);
+ content = (content!==undefined) ? content : '';
- if (this.viewOptions.list_selectable === 'multi' && column.property === '@_CHECKBOX_@') {
+ $col.addClass(((className !== undefined) ? className : '')).append(content);
+ if (width !== undefined) {
+ $col.outerWidth(width);
+ }
+ $row.append($col);
+
+ if (this.viewOptions.list_selectable === 'multi' && columns[columnIndex].property === '@_CHECKBOX_@') {
var checkBoxMarkup = '' +
' ';
$col.html(checkBoxMarkup);
}
- if (!(column.property === '@_CHECKBOX_@' || column.property === '@_ACTIONS_@') && this.viewOptions.list_columnRendered) {
+ if (!(columns[columnIndex].property === '@_CHECKBOX_@' || columns[columnIndex].property === '@_ACTIONS_@') && this.viewOptions.list_columnRendered) {
this.viewOptions.list_columnRendered({
- container: $tr,
- columnAttr: column.property,
+ container: $row,
+ columnAttr: columns[columnIndex].property,
item: $col,
- rowData: row
+ rowData: rows[rowIndex]
}, function () {});
}
}
- /*
- * Handle column header click to do sort.
- *
- * This function was extracted from the renderHeader function in this file
- *
- * Expects:
- * e.data.$headerOverlay - visible/clickable header overlay
- * e.data.$headerBase - sizer `` element
- * e.data.column - object representing raw data for clicked column
- * e.data.$tr - ` ` from ``
- * e.data.self - `this` context of the `renderHeader` function
- */
- var handleColumnSort = function handleColumnSort (e) {
- var self = e.data.self;
- // Create a new jQuery object as set of both elements.
- var $headers = e.data.$headerOverlay.add(e.data.$headerBase);
- var $chevron = e.data.$headerOverlay.find('.glyphicon.rlc:first');
- var $tr = e.data.$tr;
- var column = e.data.column;
-
- self.list_sortProperty = (typeof column.sortable === 'string') ? column.sortable : column.property;
-
+ function renderHeader ($tr, columns, index) {
var chevDown = 'glyphicon-chevron-down';
+ var chevron = '.glyphicon.rlc:first';
var chevUp = 'glyphicon-chevron-up';
- if ($headers.hasClass('sorted')) {
- if ($chevron.hasClass(chevUp)) {
- $chevron.removeClass(chevUp).addClass(chevDown);
- self.list_sortDirection = 'desc';
- } else {
- if (!self.viewOptions.list_sortClearing) {
- $chevron.removeClass(chevDown).addClass(chevUp);
- self.list_sortDirection = 'asc';
- } else {
- $headers.removeClass('sorted');
- $chevron.removeClass(chevDown);
- self.list_sortDirection = null;
- self.list_sortProperty = null;
- }
- }
- } else {
- $tr.find('th, .repeater-list-heading').removeClass('sorted');
- $chevron.removeClass(chevDown).addClass(chevUp);
- self.list_sortDirection = 'asc';
- $headers.addClass('sorted');
- }
-
- self.render({
- clearInfinite: true,
- pageIncrement: null
- });
- };
-
- var renderHeader = function renderHeader ($tr, column, columnIndex) {
+ var $div = $('
');
+ var checkBoxMarkup = '';
+ var $header = $(' ');
var self = this;
+ var $both, className, sortable, $span, $spans;
+
+ $div.data('fu_item_index', index);
+ $div.prepend(columns[index].label);
+ $header.html($div.html()).find('[id]').removeAttr('id');
- // visible portion (top layer) of header
- var $headerOverlay = $('
');
- $headerOverlay.data('fu_item_index', columnIndex);
- $headerOverlay.prepend(column.label);
+ if (columns[index].property !== '@_CHECKBOX_@') {
+ $header.append($div);
+ }
+ else {
+ $header.append(checkBoxMarkup);
+ }
- // header underlayment
- var $headerBase = $(' ');
+ $both = $header.add($div);
+ $span = $div.find(chevron);
+ $spans = $span.add($header.find(chevron));
- // actions column is _always_ hidden underneath absolute positioned actions table.
- // Neither headerBase nor headerOverlay will ever be visible for actions column.
- // This is here strictly for sizing purposes for the benefit of the other columns'
- // sizing calculations.
- if (this.viewOptions.list_actions && column.property === '@_ACTIONS_@') {
+ if (this.viewOptions.list_actions && columns[index].property === '@_ACTIONS_@') {
var width = this.list_actions_width;
- $headerBase.css('width', width);
- $headerOverlay.css('width', width);
+ $header.css('width', width);
+ $div.css('width', width);
}
- var headerClasses = [];
- headerClasses.push(column.className);
-
- var sortable = column.sortable;
- if (sortable) {
- headerClasses.push('sortable');
-
- $headerOverlay.on(
- 'click.fu.repeaterList',
- {
- 'self': self,
- '$tr': $tr,
- '$headerBase': $headerBase,
- '$headerOverlay': $headerOverlay,
- 'column': column
- },
- handleColumnSort
- );
+ className = columns[index].className;
+ if (className !== undefined) {
+ $both.addClass(className);
}
- var $chevron = $headerOverlay.find('.glyphicon.rlc:first');
+ sortable = columns[index].sortable;
+ if (sortable) {
+ $both.addClass('sortable');
+ $div.on('click.fu.repeaterList', function () {
+ self.list_sortProperty = (typeof sortable === 'string') ? sortable : columns[index].property;
+ if ($div.hasClass('sorted')) {
+ if ($span.hasClass(chevUp)) {
+ $spans.removeClass(chevUp).addClass(chevDown);
+ self.list_sortDirection = 'desc';
+ } else {
+ if (!self.viewOptions.list_sortClearing) {
+ $spans.removeClass(chevDown).addClass(chevUp);
+ self.list_sortDirection = 'asc';
+ } else {
+ $both.removeClass('sorted');
+ $spans.removeClass(chevDown);
+ self.list_sortDirection = null;
+ self.list_sortProperty = null;
+ }
+ }
- if (column.sortDirection === 'asc' || column.sortDirection === 'desc') {
- $tr.find('th, .repeater-list-heading').removeClass('sorted');
+ } else {
+ $tr.find('th, .repeater-list-heading').removeClass('sorted');
+ $spans.removeClass(chevDown).addClass(chevUp);
+ self.list_sortDirection = 'asc';
+ $both.addClass('sorted');
+ }
- headerClasses.push('sortable sorted');
+ self.render({
+ clearInfinite: true,
+ pageIncrement: null
+ });
+ });
+ }
- if (column.sortDirection === 'asc') {
- $chevron.addClass('glyphicon-chevron-up');
+ if (columns[index].sortDirection === 'asc' || columns[index].sortDirection === 'desc') {
+ $tr.find('th, .repeater-list-heading').removeClass('sorted');
+ $both.addClass('sortable sorted');
+ if (columns[index].sortDirection === 'asc') {
+ $spans.addClass(chevUp);
this.list_sortDirection = 'asc';
} else {
- $chevron.addClass('glyphicon-chevron-down');
+ $spans.addClass(chevDown);
this.list_sortDirection = 'desc';
}
- this.list_sortProperty = (typeof sortable === 'string') ? sortable : column.property;
+ this.list_sortProperty = (typeof sortable === 'string') ? sortable : columns[index].property;
}
- // duplicate the header's overlay content into the header if appropriate (possibly for dimensional styling???)
- $headerBase.html($headerOverlay.html());
-
- // place visible content into header for display to user
- if (column.property !== '@_CHECKBOX_@') {
- $headerBase.append($headerOverlay);
- } else {
- var checkBoxMarkup = '';
- $headerBase.append(checkBoxMarkup);
- }
-
- headerClasses = headerClasses.join(' ');
- $headerBase.addClass(headerClasses);
- $headerOverlay.addClass(headerClasses);
-
- $tr.append($headerBase);
- };
+ $tr.append($header);
+ }
- function renderRow ($tbody, row, rowIndex) {
+ function renderRow ($tbody, rows, index) {
var $row = $(' ');
var self = this;
- var i, l;
+ var i, length;
var isMulti = this.viewOptions.list_selectable === 'multi';
var isActions = this.viewOptions.list_actions;
if (this.viewOptions.list_selectable) {
$row.addClass('selectable');
$row.attr('tabindex', 0); // allow items to be tabbed to / focused on
- $row.data('item_data', row);
+ $row.data('item_data', rows[index]);
$row.on('click.fu.repeaterList', function () {
var $item = $(this);
@@ -784,20 +747,20 @@
}
if (this.viewOptions.list_actions && !this.viewOptions.list_selectable) {
- $row.data('item_data', row);
+ $row.data('item_data', rows[index]);
}
$tbody.append($row);
- for (i = 0; i < this.list_columns.length; i++) {
- renderColumn.call(this, $row, row, rowIndex, this.list_columns[i]);
+ for (i = 0, length = this.list_columns.length; i < length; i++) {
+ renderColumn.call(this, $row, rows, index, this.list_columns, i);
}
if (this.viewOptions.list_rowRendered) {
this.viewOptions.list_rowRendered({
container: $tbody,
item: $row,
- rowData: row
+ rowData: rows[index]
}, function () {});
}
}
@@ -823,57 +786,34 @@
}
}
- var areDifferentColumns = function areDifferentColumns (oldCols, newCols) {
- if (!newCols) {
- return false;
- }
- if (!oldCols || (newCols.length !== oldCols.length)) {
- return true;
- }
- for (var i = 0; i < newCols.length; i++) {
- if (!oldCols[i]) {
- return true;
- } else {
- for (var j in newCols[i]) {
- if (oldCols[i][j] !== newCols[i][j]) {
- return true;
- }
-
- }
- }
-
- }
- return false;
- };
-
- var renderThead = function renderThead ($table, data) {
+ function renderThead ($table, data) {
var columns = data.columns || [];
var $thead = $table.find('thead');
+ var i, length, $tr;
if (this.list_firstRender || areDifferentColumns(this.list_columns, columns) || $thead.length === 0) {
$thead.remove();
- this.list_firstRender = false;
- this.$loader.removeClass('noHeader');
-
if (data.count < 1) {
this.list_noItems = true;
}
- // insert checkbox column, if applicable
if (this.viewOptions.list_selectable === 'multi' && !this.list_noItems) {
var checkboxColumn = {
label: 'c',
property: '@_CHECKBOX_@',
sortable: false
};
- columns.unshift(checkboxColumn);
+ columns.splice(0, 0, checkboxColumn);
}
- // insert actions column, if applicable
+ this.list_columns = columns;
+ this.list_firstRender = false;
+ this.$loader.removeClass('noHeader');
+
if (this.viewOptions.list_actions && !this.list_noItems){
var actionsColumn = {
- label: this.viewOptions.list_actions.label || '',
+ label: this.viewOptions.list_actions.label || 'a ',
property: '@_ACTIONS_@',
sortable: false,
width: this.list_actions_width
@@ -881,79 +821,69 @@
columns.push(actionsColumn);
}
- this.list_columns = columns;
- var $headerRow = $(' ');
- for (var i = 0; i < columns.length; i++) {
- renderHeader.call(this, $headerRow, columns[i], i);
+ $thead = $(' ');
+ $tr = $thead.find('tr');
+ for (i = 0, length = columns.length; i < length; i++) {
+ renderHeader.call(this, $tr, columns, i);
}
-
- $thead = $(' ');
- $thead.append($headerRow);
$table.prepend($thead);
- // after checkbox column is created need to get width of checkbox column from its css class
if (this.viewOptions.list_selectable === 'multi' && !this.list_noItems) {
+ //after checkbox column is created need to get width of checkbox column from
+ //its css class
var checkboxWidth = this.$element.find('.repeater-list-wrapper .header-checkbox').outerWidth();
- columns[0].width = checkboxWidth;
+ var selectColumn = $.grep(columns, function(column){
+ return column.property === '@_CHECKBOX_@';
+ })[0];
+ selectColumn.width = checkboxWidth;
}
-
- sizeColumns.call(this, $headerRow);
+ sizeColumns.call(this, $tr);
}
- };
+ }
- var sizeColumns = function sizeColumns ($tr) {
- var autoGauge = [];
+ function sizeColumns ($tr) {
+ var automaticallyGeneratedWidths = [];
var self = this;
- var takenWidth = 0;
- var totalWidth = 0;
-
- if (self.viewOptions.list_columnSizing) {
- $tr.find('th').each(function (i, th) {
- var $th = $(th);
- var isLast = ($(this).next('th').length === 0);
-
+ var i, length, newWidth, widthTaken;
+
+ if (this.viewOptions.list_columnSizing) {
+ i = 0;
+ widthTaken = 0;
+ $tr.find('th').each(function () {
+ var $th = $(this);
+ var width;
if (self.list_columns[i].width !== undefined) {
- var width = self.list_columns[i].width;
-
- takenWidth += width;
- totalWidth += width;
-
- if (!isLast) {
- $th.outerWidth(width);
- self.list_columns[i]._auto_width = width;
- }else{
- $th.outerWidth('');// why does this work? This is invalid jQuery.
- }
+ width = self.list_columns[i].width;
+ $th.outerWidth(width);
+ widthTaken += $th.outerWidth();
+ self.list_columns[i]._auto_width = width;
} else {
- totalWidth += $th.outerWidth();
-
- autoGauge.push({
+ var outerWidth = $th.find('.repeater-list-heading').outerWidth();
+ automaticallyGeneratedWidths.push({
col: $th,
index: i,
- last: isLast,
- minWidth: $th.find('.repeater-list-heading').outerWidth()
+ minWidth: outerWidth
});
}
- });
-
- var canvasWidth = self.$canvas.find('.repeater-list-wrapper').outerWidth();
- var newWidth = Math.floor((canvasWidth - takenWidth) / autoGauge.length);
- for (var i = 0; i < autoGauge.length; i++) {
- var th = autoGauge[i];
-
- if (newWidth < th.minWidth) {
- newWidth = th.minWidth;
- }
+ i++;
+ });
- if (!th.last || canvasWidth < totalWidth) {
- th.col.outerWidth(newWidth);
- self.list_columns[th.index]._auto_width = newWidth;
+ length = automaticallyGeneratedWidths.length;
+ if (length > 0) {
+ var canvasWidth = this.$canvas.find('.repeater-list-wrapper').outerWidth();
+ newWidth = Math.floor((canvasWidth - widthTaken) / length);
+ for (i = 0; i < length; i++) {
+ if (automaticallyGeneratedWidths[i].minWidth > newWidth) {
+ newWidth = automaticallyGeneratedWidths[i].minWidth;
+ }
+ automaticallyGeneratedWidths[i].col.outerWidth(newWidth);
+ this.list_columns[automaticallyGeneratedWidths[i].index]._auto_width = newWidth;
}
}
}
- };
+ }
function specialBrowserClass() {
var ua = window.navigator.userAgent;
diff --git a/js/repeater.js b/js/repeater.js
index b34225919..c74644b70 100755
--- a/js/repeater.js
+++ b/js/repeater.js
@@ -15,9 +15,9 @@
if (typeof define === 'function' && define.amd) {
// if AMD loader is available, register as an anonymous module.
define(['jquery', 'fuelux/combobox', 'fuelux/infinite-scroll', 'fuelux/search', 'fuelux/selectlist'], factory);
- } else if (typeof exports === 'object') {
- // Node/CommonJS
- module.exports = factory(require('jquery'));
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS
+ module.exports = factory(require('jquery'));
} else {
// OR use browser globals if AMD is not present
factory(jQuery);
@@ -118,7 +118,7 @@
self.resizeTimeout = setTimeout(function () {
self.resize();
self.$element.trigger('resized.fu.repeater');
- }, 500);//any faster and you get weird catastrophic errors with the header of the list repeater
+ }, 75);
});
this.$loader.loader();
@@ -644,9 +644,9 @@
var footerHeight = this.$element.find('.repeater-footer').outerHeight();
var bottomMargin = (viewportMargins.bottom === 'auto') ? 0 : parseInt(viewportMargins.bottom, 10);
var topMargin = (viewportMargins.top === 'auto') ? 0 : parseInt(viewportMargins.top, 10);
- height = staticHeightValue - headerHeight - footerHeight - bottomMargin - topMargin;
- this.$viewport.outerHeight(height); // but WHY are we setting the outerHeight of the viewport to this???
+ height = staticHeightValue - headerHeight - footerHeight - bottomMargin - topMargin;
+ this.$viewport.outerHeight(height);
} else {
this.$canvas.removeClass('scrolling');
}
diff --git a/less/repeater-list.less b/less/repeater-list.less
index 0c936bb5e..657a372d1 100755
--- a/less/repeater-list.less
+++ b/less/repeater-list.less
@@ -63,10 +63,6 @@
&.sorted {
background: @gray98;
}
-
- &.repeater-list-actions-placeholder {
- border-left: none;
- }
}
tr {
@@ -127,6 +123,10 @@
float: right;
margin-top: 2px;
}
+
+ .actions-hidden {
+ visibility: hidden;
+ }
}
}
@@ -270,7 +270,6 @@
border-left: 1px solid transparent;
th {
background: transparent;
- padding-left: 0;
}
}
td {
@@ -316,6 +315,12 @@
}
}
}
+ .actions-thead-wrapper {
+ position: absolute;
+ top: 0;
+ right: 0;
+ z-index: 3;
+ }
table {
table-layout: fixed;
word-wrap: break-word;
@@ -426,4 +431,3 @@
}
}
}
-