FixedTable.js
/**
     * Fix the thead of the desired table if this is not visible
     * @param {DOM element} table:    The table of the you want fix the thead
     * @param {DOM element} parent:   The element that contains to the table and have scroll in y
     * @param {int}          modelRowIndex: Index based-zero of the row of the tbody to use for determinate the cell sizes
     */
Fix the thead of the desired table if this is not visible
@param {DOM element} table:    The table of the you want fix the thead
@param {DOM element} parent:   The element that contains to the table and have scroll in y
@param {int}          modelRowIndex: Index based-zero of the row of the tbody to use for determinate the cell sizes
Fix the thead of the desired table if this is not visible @param { DOM element } table : The table of the you want fix the thead @param { DOM element } parent : The element that contains to the table and have scroll in y @param { int } modelRowIndex : Index based - zero of the row of the tbody to use for determinate the cell sizes
function fixedTable(table, parent, modelRowIndex, modelHeaderIndex) {
        var head = table.querySelector('thead'),
            tableObj = {
                table: table,
                parent: parent,
                headIsVisible: isElementVisibleInViewport(table, _sides.Top, parent),
                parentIsVisible: isElementVisibleInViewport(parent, _sides.Any, undefined),
                modelRowIndex: modelRowIndex ? modelRowIndex + 1 : 1,
                modelHeaderIndex: modelHeaderIndex ? modelHeaderIndex + 1 : 1
            };
        var elements = Array.prototype.slice.call( tableObj.parent.querySelectorAll('*'));
        elements.forEach(function(e) { e.style.boxSizing = 'border-box'; });
        tableObj.parent.scrollTop = 0;
        tableObj.parent.style.overflowX = 'hidden';
        tableObj.parent.style.paddingRight = '1px';
        tableObj.table.cellPadding = 0;
        tableObj.table.cellSpacing = 0;  
        tableObj.table.style.width = '100%';     
        addEventListeners(tableObj.parent, function tableListener(e) {
            e.preventDefault();
            setGhostHeader.call(e, tableObj);
            reviewScroll.call(e, tableObj);
        });
        _tables.push(tableObj);
    }
function fixedTable ( table , parent , modelRowIndex , modelHeaderIndex ) { var head = table . querySelector ( 'thead' ) , tableObj = { table : table , parent : parent , headIsVisible : isElementVisibleInViewport ( table , _sides . Top , parent ) , parentIsVisible : isElementVisibleInViewport ( parent , _sides . Any , undefined ) , modelRowIndex : modelRowIndex ? modelRowIndex + 1 : 1 , modelHeaderIndex : modelHeaderIndex ? modelHeaderIndex + 1 : 1 } ; var elements = Array . prototype . slice . call ( tableObj . parent . querySelectorAll ( '*' ) ) ; elements . forEach ( function ( e ) { e . style . boxSizing = 'border-box' ; } ) ; tableObj . parent . scrollTop = 0 ; tableObj . parent . style . overflowX = 'hidden' ; tableObj . parent . style . paddingRight = '1px' ; tableObj . table . cellPadding = 0 ; tableObj . table . cellSpacing = 0 ; tableObj . table . style . width = '100%' ; addEventListeners ( tableObj . parent , function tableListener ( e ) { e . preventDefault ( ) ; setGhostHeader . call ( e , tableObj ) ; reviewScroll . call ( e , tableObj ) ; } ) ; _tables . push ( tableObj ) ; }
Fix the thead of the desired table if this is not visible
 @param {DOM element} table:    The table of the you want fix the thead
 @param {DOM element} parent:   The element that contains to the table and have scroll in y
 @param {int}          modelRowIndex: Index based-zero of the row of the tbody to use for determinate the cell sizes
Fix the thead of the desired table if this is not visible @param { DOM element } table : The table of the you want fix the thead @param { DOM element } parent : The element that contains to the table and have scroll in y @param { int } modelRowIndex : Index based - zero of the row of the tbody to use for determinate the cell sizes
// add an event handler to the document scroll for adjust the position of the fixed THead