Shots/Assets list: Fix fixed table header not resizing when adjusting col_main width

This commit is contained in:
2017-06-14 18:25:49 +02:00
parent c38203ba63
commit 28edb86aeb
3 changed files with 59 additions and 14 deletions

View File

@@ -145,8 +145,8 @@ $(window).on('load resize', function(){
});
/* Fix header of items list (like assets or shots */
function itemsListFixHeader(toClone, toAppend){
/* Clone children elements, used to fix the header of items_list (like assets or shots) */
function cloneChildren(toClone, toAppend){
var target = $(toClone);
var target_children = target.children();
var clone = target.clone();
@@ -156,3 +156,25 @@ function itemsListFixHeader(toClone, toAppend){
});
$(toAppend).append(clone);
}
/* Scroll fixed headers horizontally, used for the header of items_list (like assets or shots) */
function scrollHeaderHorizontal(scrollableClassName, fixedContainer, offset){
var $table_list = $('.item-list');
$table_list.scroll(function(e) {
// Scroll of the table scrollableClassName from the left minus offset, inverted (multiplied by -1)
var table_header_offset = ($table_list.scrollLeft() - offset) * - 1
$(fixedContainer).css('left', table_header_offset);
});
}
// For every column, set the width of the fixed header using the original columns width
function setHeaderCellsWidth(tableHeaderRowOriginal, tableHeaderRowFixed) {
var table_header = $(tableHeaderRowOriginal).children();
var table_header_fixed = $(tableHeaderRowFixed).children();
table_header_fixed.width(function(i,val) {
return table_header.eq(i).width();
});
}