All examples By author By category About

linhaoran917

Create a reusable table using d3 and jquery DataTables

This is an exmaple of resuable components using d3. They are described as 'closures (i.e. functions) with setters and getters'. In this example, _table is the closure.

To make the component responsive, we add a dispatcher which broadcasts events happening inside the component to all listeners. In this example, a div listens to highlight and select events from the table, and changes its text accordingly.

Notice that I didn't assume anything about the data other that its structure. Also, I didn't hardcode any data-specific attributes.

forked from ahmohamed's block: Create a reusable table using d3 and jquery DataTables

forked from anonymous's block: Create a reusable table using d3 and jquery DataTables

forked from anonymous's block: Create a reusable table using d3 and jquery DataTables