Skip to content

Commit

Permalink
[ui:cwd] fix Studio-42#2152 table header position unmatch in the rtl …
Browse files Browse the repository at this point in the history
…language
  • Loading branch information
nao-pon committed Aug 18, 2017
1 parent 0a7d014 commit 0edf706
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions js/ui/cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,17 +857,10 @@ $.fn.elfindercwd = function(fm, options) {
return;
}
var setPos = function() {
var val, pos;

if (fm.direction === 'ltr') {
val = wrapper.scrollLeft() * -1;
pos = 'left';
} else {
val = wrapper.scrollLeft();
pos = 'right';
}
if (base.css(pos) !== val) {
base.css(pos, val);
var val;
val = (fm.direction === 'ltr')? wrapper.scrollLeft() * -1 : table.outerWidth(true) - wrapper.width() - wrapper.scrollLeft();
if (base.css('left') !== val) {
base.css('left', val);
}
},
opts = opts || {},
Expand All @@ -888,17 +881,18 @@ $.fn.elfindercwd = function(fm, options) {
tableHeader = $('<div/>').addClass(wrapper.attr('class') + ' elfinder-cwd-fixheader')
.removeClass('ui-droppable native-droppable')
.css(wrapper.position())
.css('height', hheight)
.css({ height: hheight, width: cwd.outerWidth() })
.append(base);
if (fm.direction === 'rtl') {
tableHeader.css('right', (fm.getUI().width() - wrapper.width()) + 'px');
tableHeader.css('left', (wrapper.data('width') - wrapper.width()) + 'px');
}
setPos();
wrapper.after(tableHeader)
.on('scroll.fixheader resize.fixheader', function(e) {
setPos();
if (e.type === 'resize') {
e.stopPropagation();
wrapper.data('width', wrapper.css('overflow', 'hidden').width());
fixTableHeader();
}
});
Expand Down Expand Up @@ -928,10 +922,10 @@ $.fn.elfindercwd = function(fm, options) {
tableHeader.data('widthTimer') && clearTimeout(tableHeader.data('widthTimer'));
tableHeader.data('widthTimer', setTimeout(function() {
if (tableHeader) {
tableHeader.css('width', cwd.outerWidth() + 'px');
if (fm.direction === 'rtl') {
tableHeader.css('right', (fm.getUI().width() - wrapper.width()) + 'px');
tableHeader.css('left', (wrapper.data('width') - wrapper.width()) + 'px');
}
tableHeader.css(wrapper.position()).css('width', cwd.outerWidth() + 'px');
}
}, 10));
}
Expand Down Expand Up @@ -2060,9 +2054,9 @@ $.fn.elfindercwd = function(fm, options) {
if (cwdoh < wph) {
cwd.height(wph);
}
}, 20);
}, 10);

list && ! colResizing && fixTableHeader();
list && ! colResizing && (init? wrapper.trigger('resize.fixheader') : fixTableHeader());

wrapperRepaint();
},
Expand Down

0 comments on commit 0edf706

Please sign in to comment.