Dynamic grid row height

Версия от 13:54, 8 октября 2018; VitaliyFilippov (обсуждение | вклад)

https://www.ag-grid.com/javascript-grid-row-height/

«By default, the grid will display rows at 25px. You can change this for each row individually to give each row a different height.»

  • Use reasonable fixed minimum row height
  • Always render (screen/minHeight) last rows
  • Find maximum possible viewport start (in units of item number + % of item)
  • Measure average height of last rows
  • avgHeight = max(minHeight, lastRowAvgHeight)
  • targetHeight = avgHeight*rowCount + headerHeight
  • Set sizer to targetHeight
  • scrollPos = targetHeight > offsetHeight ? min(1, scrollTop / (targetHeight — offsetHeight)) : 0
  • First visible item will be Math.floor(scrollPos*maxPossibleViewportStart)
  • Additional scroll offset will be itemOffset = scrollPos*maxPossibleViewportStart-Math.floor(scrollPos*maxPossibleViewportStart)*firstVisibleItemHeight
  • First (top) placeholder height will be scrollTop-firstVisibleItemHeight+itemOffset
  • Second (middle) placeholder height will be avgHeight*nodeCount — sum(heights of all rendered rows) — (first placeholder height)

Do you want to try some new features? By joining the beta, you will get access to experimental features, at the risk of encountering bugs and issues.

Ок Нет, спасибо