jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.7k stars 820 forks source link

JExcel + JSuites dropdown hidden in scrolling datagrid (+hacky fix) #662

Open ScottishDarren opened 4 years ago

ScottishDarren commented 4 years ago

While building a prototype jexcel grid that scrolls horizontally I came across an issue where when the jquites dropdown were hidden by the overflow. I implemented a hacky fix in jsuites.js that fixes it for us in jExcel, but it uses hardcoded element id's. I'm sure Paul could code a better solution, but it works for my purposes.

There's a video explanation here: https://www.screencast.com/t/qunU3ESUu1

And the adjusted code in jsuites.js from line 2444 is

// #mod get jexcel datagrid
var grid = document.getElementById("maintool").querySelectorAll(".jexcel_content");

if (window.innerHeight < rect.bottom + rectContainer.height) {
    container.style.top = (-1 * (rectContainer.height)) + 'px';
} else if(typeof(grid) !== 'undefined' && grid[0].offsetHeight - 100 < rect.bottom + rectContainer.height){
    // if inside a scrolling grid make dropdown expand up.
    container.style.top = (-1 * (rectContainer.height)) + 'px';
} else{
    container.style.top = '';
}

This is using a hardcoded #maintool CSS id, so isn't really generic enough for all uses and no doubt could be improved.

hmzlam commented 4 years ago

thanks