NeXTs / Clusterize.js

Tiny vanilla JS plugin to display large data sets easily
https://clusterize.js.org
MIT License
7.22k stars 412 forks source link

Using prepend duplicates the item #163

Open ArcherEmiya05 opened 5 years ago

ArcherEmiya05 commented 5 years ago

Im using real time database and listen to every new added item. My array contains only 2 item, but it re-display an item which is the first item. How to properly implement prepend() in dynamic content?

function someFunction(){

 const reports = [];

    const clusterize1 = new Clusterize({
      scrollId: 'scroll-area1',
      contentId: 'content-area1'
    });

//fetch from db
foreach(){

if(newAddedItem){
reports.push(some  tags);
clusterize1.prepend(reports);
}

}
}
ArcherEmiya05 commented 5 years ago

My goal is always put at the top every new added item