javascript - SlickGrid.js viewport visibility toggling issues with Internet Explorer -
i'm using slickgrid.js library , excellent!
only major problem right internet explorer (confirmed in 9, 10, , 11), standards compliant browsers chrome , ff work fine.
problem: when grid scrolled , hidden , re-shown in ie scroll position reset top of grid, , viewport/data either cut off or hidden (depending on scroll amount).
here fiddle demonstrates slickgrid.js ie bug (using author's simple example 1):
http://jsfiddle.net/crwxoc17/1/
anybody have generic fix or patch slick grid?
i can call grid.resizecanvas()
sorta fix issue, resets scrollbar top , it's annoying every single grid deal internet explorer.
semi-working fix, still screws scrolltop
:
function onshowgrid1() { grid.resizecanvas(); }
(reviewing js code now, have not yet confirmed whether bug microsoft's or slickgrid's)
this issue applies element in ie overflow set scroll or auto , visibility toggled. there's simple example here: https://jsfiddle.net/qkhxl6r8/4/
that said, if you'd scrolltop position preserved extend slickgrid or create wrapper class subscribes onscroll event, records scrolltop value, , sets on viewport element when showing or hiding grid. modified example code proof of concept here: http://jsfiddle.net/h9cu2cmp/4/
var lastscrolltop; var scrolltimeout; function updatescrolltop(e, args){ cleartimeout(scrolltimeout); scrolltimeout = settimeout(function(){ lastscrolltop = args.scrolltop; }, 30); } //... grid.onscroll.subscribe(updatescrolltop); $('body').on('click', '.toggle-button', function(){ $("#mygrid").toggle(); if(lastscrolltop !== undefined){ $("#mygrid").find('.slick-viewport').get(0).scrolltop = lastscrolltop; } });
if you're using remote data provider can trigger ensuredata updated scrolltop grid.onviewportchanged.notify()
Comments
Post a Comment