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

Load Clusterize using node.js #56

Closed TheColorRed closed 8 years ago

TheColorRed commented 8 years ago

How do you use this within node.js (Specifically electron for desktop applications)?

When I try this I get an error:

require('clusterize.js');
var clusterize = new Clusterize({
    rows: data,
    scrollId: 'scrollArea',
    contentId: 'contentArea'
});

Clusterize is not defined

NeXTs commented 8 years ago

Install it via npm

npm i clusterize.js

And use commonJS syntax

var Clusterize = require('Clusterize');
TheColorRed commented 8 years ago

How would you then pass the 2 required options to it?

NeXTs commented 8 years ago
// load dependency
var Clusterize = require('Clusterize');

// create instance
var clusterize = new Clusterize({
    rows: data,
    scrollId: 'scrollArea',
    contentId: 'contentArea'
});
TheColorRed commented 8 years ago

Alright thanks! I'll give that a try!

NeXTs commented 8 years ago

To be honest, I never ran Clusterize.js on the node.js as it's browser-oriented library in general.

Module support was implemented for module loaders like require.js, browserify which support amd and commonjs specifications on the client side.

What you trying to achieve by running Clusterize.js on backend side?

TheColorRed commented 8 years ago

I am actually running it using Electron which is to make desktop applications:

Build cross platform desktop apps with web technologies

http://electron.atom.io/

Electron uses webkit to display the content of the window which is written with HTML/CSS/JavaScript. You can then leverage node to do node related tasks.

So I am making a database manager (Similar to mysql workbench, dbBever, HeidiSQL, etc.)

NeXTs commented 8 years ago

Cool :+1: