GithubHelp home page GithubHelp logo

giorgi-ghviniashvili / table-grid Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 1.71 MB

Lightweight table grid component

Home Page: https://giorgi-ghviniashvili.github.io/table-grid/

HTML 4.71% JavaScript 75.54% CSS 19.76%
table data-grid data-grid-view d3-table pure-js pure-js-table

table-grid's Introduction

Lightweight table grid component

Default
Dark

Features:

  • responsive
  • highly configurable
  • dynamic columns with icons
  • sortable and filterable
  • column categories
  • different themes
  • only one dependency - d3.js v7
  • color coded cells
  • pagination

Initialize

const table = Table({
  data,
  headers,
  container: "#table",
}).render();

Header format:

const headers = [
  {
    id: 0,
    isMainColumn: true,
    name: "City",
    icon: null,
    propName: "City",
    sort: false, // disable sort
    cellTemplate: (d) => {
      return `${d.City}`;
    },
    headerTemplate: () => {
      return new Promise((res) => {
        res(`<div class="table-icon">
          <div class="arrow">
            ${arrow}
          </div>
          <div class="location-txt">
            Location
          </div>
        </div>`)
      })
    },
  },
  {
    id: 1,
    name: "Column A",
    icon: "icon url here",
    propName: "column_a",
    rankProp: "column_a",
    sort: sortFunc,
    class: "", // apply additional class
    cellTemplate: () => {
      return `<h1>Any html content here</h1>`
    },
    headerTemplate: () => {
      return new Promise((res) => {
        res(`<div class="table-icon">
          <div class="arrow">
            ${arrow}
          </div>
          <div class="square-icon">
            <div class="icon">[icon svg as text]</div>
          </div>
          <div class="header-text">
            ${name}
          </div>
        </div>`)
      })
    },
    order: "asc", // default order
    colorScale: (colorDomain) => d3.scaleQuantile(colorDomain, colors),
    category: "category a"
  }
]

table-grid's People

Contributors

giorgi-ghviniashvili avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dexit

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.