GithubHelp home page GithubHelp logo

isabella232 / ember-light-table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ota-insight/ember-light-table

0.0 0.0 0.0 5.11 MB

Lightweight, contextual component based table for Ember 2.3+

Home Page: http://offirgolan.github.io/ember-light-table/

License: MIT License

JavaScript 78.14% CSS 5.26% HTML 16.60%

ember-light-table's Introduction

Ember Light Table

Ember Version Build Status npm version Ember Observer Score Code Climate Test Coverage Dependency Status devDependency Status

A lightweight contextual component based table addon that follows Ember's actions up, data down ideology.

Features

  • Custom component based column headers and cells
  • Infinite scroll support
  • Select & Multi-select
  • Fixed header and footer
  • Grouped columns
  • Expandable rows
  • Easy table manipulation
  • Easy override to table header and footer
  • Contextual component for header, body, and footer, as well as loading, no data, and expanded row

Installation

ember install ember-light-table

Helpful Links

Looking for help?

If it is a bug please open an issue on GitHub.

Usage

There are two parts to this addon. The first is the Table which you create with column definitions and rows, and the second is the component declaration.

Table Declaration

The Table constructor accepts an array of Columns or column options and an array of rows.

import Table from 'ember-light-table';
const table = new Table(columns, rows);

Here is a more real-word example

// components/my-table.js
import Ember from 'ember';
import Table from 'ember-light-table';

const computed = Ember.computed;

export default Ember.Component.extend({
  model: null,
  table: null,

  columns: computed(function() {
    return [{
      label: 'Avatar',
      valuePath: 'avatar',
      width: '60px',
      sortable: false,
      cellComponent: 'user-avatar'
    }, {
      label: 'First Name',
      valuePath: 'firstName',
      width: '150px'
    }, {
      label: 'Last Name',
      valuePath: 'lastName',
      width: '150px'
    }, {
      label: 'Address',
      valuePath: 'address'
    }, {
      label: 'State',
      valuePath: 'state'
    }, {
      label: 'Country',
      valuePath: 'country'
    }];
  }),

  init() {
    this._super(...arguments);
    this.set('table', new Table(this.get('columns'), this.get('model')));
  }
});

For a list of possible column options, please checkout out the docs.

Component Declaration

Now that we have our table, we can declare our component in our template.

{{#light-table table as |t|}}
  {{t.head}}

  {{#t.body as |body|}}
    {{#body.expanded-row as |row|}}
      Hello <b>{{row.firstName}}</b>
    {{/body.expanded-row}}

    {{#if isLoading}}
      {{#body.loader}}
        Loading...
      {{/body.loader}}
    {{/if}}

    {{#if table.isEmpty}}
      {{#body.no-data}}
        No users found.
      {{/body.no-data}}
    {{/if}}
  {{/t.body}}

  {{t.foot}}
{{/light-table}}

Please note that each of these contextual components have a wide array of options so it is advised to look through the documentation.

ember-light-table's People

Contributors

offirgolan avatar greenkeeperio-bot avatar taras avatar robbiethewagner avatar acorncom avatar efx avatar sivakumar-kailasam avatar koemeet avatar ember-tomster avatar

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.