[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-190-gd469680
Shawn Moore
shawn at bestpractical.com
Tue Jan 24 13:56:01 EST 2017
The branch, 4.6/inline-edit has been updated
via d469680d28fe6d54996b9cf72036a5d990054641 (commit)
from cd80a38e9a29813ad79c5f87611a5eec70132db3 (commit)
Summary of changes:
share/static/js/util.js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit d469680d28fe6d54996b9cf72036a5d990054641
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Jan 24 18:42:54 2017 +0000
Improve fixing table layout in place for inline edit
Using column width percentage instead of fixed pixel widths allows the
layout to adjust as the browser is resized.
Switch to consulting a real cell's width, not <col> width. Chrome
returns 0 for col.width(), causing the table-layout: fixed to divide the
column widths equally rather than the desired effect of keeping the
layout fixed between display and inline edit.
Fixes: T#180050
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 35d5901..f07304e 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -772,14 +772,20 @@ jQuery(function () {
jQuery('table.collection-as-table').each(function () {
var table = jQuery(this);
var cols = table.find('colgroup col');
- if (cols.length == 0) {
+ var firstRow = table.find('tr:first');
+
+ if (cols.length == 0 || firstRow.length == 0) {
return;
}
- cols.each(function () {
+ var totalWidth = firstRow.width();
+
+ cols.each(function (index) {
var col = jQuery(this);
- col.attr('width', col.width());
+ var cell = firstRow.children().eq(index);
+ col.attr('width', (100 * cell.width() / totalWidth) + '%');
});
+
table.css('table-layout', 'fixed');
});
-----------------------------------------------------------------------
More information about the rt-commit
mailing list