Giter Site home page Giter Site logo

tablemutt's Introduction

TableMutt from Datadog

A sortable table for large datasets

Here at Datadog, a big part of our job is making big datasets easier to navigate. We recently outgrew our 3rd party Javascript sortable table plugin, and needed something lighter weight and more flexible.

Enter TableMutt, a lightweight and extensible sortable table widget. TableMutt can separately customize the representation used for sorting, the representation for text searching, and the actual displayed markup for a given table column. You can also specify the transform function to pull out data for a particular column, which defaults to getting the property whose name matches the id property on the column.

Simple Example: Characters from The Wire

This example shows how to override the transform function that retrieves the column value from the row object. For a more involved example, see demo.html in this repo.

var data = [
	{name: "Jimmy McNulty", episodes: 56, desc: "Homicide Detective"},
	{name: "Cedric Daniels", episodes: 58, desc: "Deputy Commissioner for Operations"},
	{name: "Thomas \"Herc\" Hauk", episodes: 52, desc: "Defense investigator"},
	{name: "William Rawls", episodes: 46, desc: "Police Commissioner"}
];

var columns = [
	{id: "name"},
	{id: "desc", name: "Bio"}, // show a column title that's not the property
	{
    id: "total",
    transform: function (d) {
      // transform the row object `d` into a cell value for this column
      return d.episodes;
    }
  }
];

var options = {
	sortOrder: ['-episodes', 'name']
};

var table = new TableMutt(
	"#table_container", // element with this id to stick the <table> in
	columns,
	options
);

table.load(data);

As of this writing, the widget depends on Underscore.js and d3.js. It has been tested with Underscore.js v. 1.5.1 and d3.js v.3, but may work with older versions.

Created by our hackNY '13 fellow, Joseph Long, during his time at Datadog.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.