npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-imdt-table

v0.3.11

Published

This is an Ember Table Component inspired on Ember-models-table: https://github.com/onechiporenko/ember-models-table

Downloads

116

Readme

Ember-imdt-table

This is an Ember Table Component inspired on Ember-models-table: https://github.com/onechiporenko/ember-models-table

Installation

  • git clone this repository
  • npm install
  • bower install

Usage

First set your content up, here we are using a predefined json as the content, but you can use your model aswell.

// ../controllers/index.js
values = [
  {
    "id":1,
    "firstName":"Kiana",
    "lastName":"Murphy",
    "age":19,
    "city":"Lahore",
    "cityWithHtml":"<i>Lahore</i>"},
  {
    "id":2,
    "firstName":"Ingeborg",
    "lastName":"Jones",
    "age":48,
    "city":"Tianjin",
    "cityWithHtml":"<i>Tianjin</i>"},
  {
    "id":3,
    "firstName":"Chuck",
    "lastName":"Ali",
    "age":32,
    "city":"Bogotá",
    "cityWithHtml":"<i>Bogotá</i>"},
  {
    "id":4,
    "firstName":"Chasity",
    "lastName":"Quinn",
    "age":36,
    "city":"Cairo",
    "cityWithHtml":"<i>Cairo</i>"},
  {
    "id":5,
    "firstName":"Chuck",
    "lastName":"Taylor",
    "age":44,
    "city":"Lahore",
    "cityWithHtml":"<i>Lahore</i>"
  }
];

Then set up the table properties,

// ../controllers/index.js

content: values,
columns: new A([{
  contentPath: 'id',
  columnTitle: 'ID',
  isSortable: false,
  isSearchable: false,
}, {
  contentPath: 'firstName',
  columnTitle: 'First Name'
}, {
  contentPath: 'lastName',
  columnTitle: 'Last Name'
}, {
  contentPath: 'cityWithHtml',
  columnTitle: 'City',
  sortPath: 'city'
},
{
  contentPath: 'age',
  columnTitle: 'Age'
},

After you have everything set up, all you need to do is use the table helper on your template and pass your defined properties as parameters, along with more options:

<!-- ../templates/index.hbs -->

{{imdt-table
  content=content
  columns=columns
  sortProperties=sort
  paginable=true
  searchable=true
  sortable=true
}}

If you want to set some sort properties for the table to be sorted on load you can do it, like this:

sort: new A(['city:desc', 'firstName:desc', 'lastName:asc']),

Supported Properties

property|description|default ----|------|----- content| content that will be displayed in the table cells|null columns|column configuration and names|null sortProperties|sort properties on load|null paginable |whether the table has pagination or not|false searchable|whether the table has search or not|false sortable|whether the table is sortable or not|false useSimplePagination|whether the page has simple pagination or numbered pagination|true

Rendering templates on column

If you want to render a custom template inside a table cell, like a button, checkbox, or wathever else you would need you can do it by adding the column that will render the template in your column configuration, like this:

// ../controllers/index.js

columns: new A([{
    contentPath: 'id',
    columnTitle: 'ID',
    isSortable: false,
    isSearchable: false,
  }, {
    contentPath: 'firstName',
    columnTitle: 'First Name'
  }, {
    contentPath: 'lastName',
    columnTitle: 'Last Name'
  }, {
    contentPath: 'cityWithHtml',
    columnTitle: 'City',
    sortPath: 'city'
  },
  {
    contentPath: 'age',
    columnTitle: 'Age'
  },
  {
    contentPath: 'template',
    columnTitle: 'Template',
    template: 'custom/button'
  }

...

Running

  • ember server
  • Visit your app at http://localhost:4200.