dimanche 12 novembre 2017

Performant data-tables with JavaScript

Introduction

I am making a request to a backend and getting a list of objects in JSON. Then I change it into an HTML table (it is a Vuetify data-table) where every object is a row.

Each row contains an array of exactly 72 ones and zeros ([1, 1, 1, 1, 0, ...]). They indicate activity back in time (72 hours).

In each row I have a for loop (kind of. It is Vue.js v-for directive) that goes through that array and loads an image 1.svg or 0.svg accordingly, to make a chart.

With 40 rows only, the table becomes to lag a little. Now, the table is quite wide and so it goes off screen (overflow: scroll or whatever).

TL;DR

Is it possible in JavaScript to somehow fluently hide DOM elements (in this case table cells (and rows)) (hide means remove from DOM, so that the browser doesn't have to render all of them) when they are off the screen?

Is there a literature you could recommend? Any tutorials? What to look for?

I remember seeing a Google talk on a list of thousands of elements scrolling smoothly on mobile, but can't seem to find it.




Aucun commentaire:

Enregistrer un commentaire