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

How does it work ? #25

Closed dhoko closed 9 years ago

dhoko commented 9 years ago

Hi,

I try to test it, here is my setup:

  <!--HTML-->
  <div id="scrollArea" class="clusterize-scroll">
    <div id="contentArea" class="clusterize-content">
      <div class="clusterize-no-data">Loading data…</div>
    </div>
  </div>
  var i = 1000;
  var data = [];
  var tmp = [];

  while(--i >= 0) {
    tmp.length = 0;
    tmp.push('<article>')
    tmp.push('<h1>Title {{id}}</h1>'.replace('{{id}}', i))
    tmp.push('<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error doloribus est commodi repellat tenetur eveniet quia nisi. Eos repellat ipsam neque veritatis aliquam voluptatem, dolorem distinctio dolore blanditiis dignissimos aperiam.</p>')
    tmp.push('</article>')
    data.push(tmp.join(''))
  }

  var clusterize = new Clusterize({
    rows: data,
    scrollId: 'scrollArea',
    contentId: 'contentArea',
    rows_in_block: 40
  });
document.querySelectorAll('article')
NodeList[161]

I don't understand how to use it, onScroll nothing change. My list contains 160 article, I was thinking it would be 40. What's the problem with my setup ?

I didn't find any quick start readme. Thanks

NeXTs commented 9 years ago

Your code works fine for me. Just copy-pasted your example to jsFiddle and everything works as expected.

http://jsfiddle.net/2n1y0aj0/

NeXTs commented 9 years ago

Please provide your sources at jsfiddle

dhoko commented 9 years ago

Mea culpa, I forgot to add the CSS. With it, it works as expected O_o.

beshur commented 9 years ago

Hi, @NeXTs.

Was checking you fiddle, when noticed the problem that 50 elements are missing: http://take.ms/MapqT (check out the screencast)

NeXTs commented 9 years ago

Hi @beshur That fiddle uses old v0.7.1 version. What is funny is that this bug was fixed in v0.8.0 :) Better use last version v0.13.0 which was released today Check out updated fiddle with v0.12.0, CDN's not updated to v0.13.0 yet.

beshur commented 9 years ago

Thanks for reply, @NeXTs.

I'm using 0.12.0 which is on cdnjs.

NeXTs commented 9 years ago

And problem still occurs?

beshur commented 9 years ago

@NeXTs, I can't notice this as have large chunks of very similar data. Had a problem with the rows parameter, but just figured it out.

Everything's ok.