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-cli-filtertable-inbox-health

v1.1.3

Published

A HTML table with some added controls

Downloads

23

Readme

#Ember CLI Filter Table Build Status

Description

This component is an Ember CLI add-on which presents a standard html table but allows for extra options. It includes a text input box for easy filtering, as well as hooks for dropdown filtering. It also allows for extra buttons in the header which can activate/deactivate based on selections in the table.

Installation

npm install ember-cli-filtertable-inbox-health --save-dev

##Basic Usage

{{filter-table content=content bodyTemplate="mytable-body"
               headerTemplate="mytable-header"}}

Demo

Clone this repo and run the app

sudo npm install -g ember-cli
git clone [email protected]:gevious/ember-filtertable
cd ember-filtertable
npm install; bower install
ember serve

Options

When calling the filter table, the following options are available:

General Options

viewLimit

Type: Number Default: 20

This is the number of maximum records that will be shown in the table. If it is set to 0, no limit will be enforced.

columnNum

Type: Number Default: 2

This is the number of columns within the table. It is needed to calculate the header colspan attribute.

selectedRecords

Type: Array Default: selectedRecords

This option is only needed when implementing logic that needs to know how many records are selected. By default, it will use the selectedRecords field on the controller if it hasn't been defined at startup.

reloadRecords

Type: Boolean

Link this value to a variable in the controller to be able to refresh the table at will. This is particularly useful if one wants to implement some table filters (ie dropdown filters) and update the table after the filter has been selected. This value is reset to false every time the table is refreshed manually.

isTree

Type: Boolean Default: false

When this is set, the table will assume the data is in a tree view. For this to work the data must have the following fields defined:

  • parent - a belongsTo relationship containing the parent record
  • children - a hasMany relationship to all its children
  • depth - the depth of the record in the tree (1 being a root node)
  • childNum - returns a count of the number of children a record has

showSearchAncestors

Type: Boolean Default: true

With this selection activated the whole line of ancestry is shown in the table if the search filter matches a child. To only display the child record, set this to false.

Text Filter Options

showTextFilter

Type: Boolean Default: true

Either show or hide the text input for record filtering in the header

filterField

Type: String Default: name

The field in each record on which to apply the text filtering

Checkbox options

showCheckboxes

Type: Boolean Default: true

This will show the select all checkbox in the header. It is a convenience checkbox to allow for quick selecting of the whole visible record set

toggleSelected

Type: Boolean Default: false

By default no records are selected, but setting this to true will mark all visible records as selected.

Table rows

Since table rows aren't called directly anymore, but rather via the component, any defined actions won't actually call the controller. We've added 5 proxies to the component which will call an action on the component. They are called:

submit, remove, action1, action2, action3

To get them to work correctly, you'll need to define the action as follows:

<td {{action "remove" "removeRow" r}}>(remove)</td>

That definition will call the removeRow action on the controller with the current record.

Tree view

The table can be setup to display a tree view of records. Since this adds quite a bit of overhead, it needs to be enabled with the property isTree.

Note: At this point, the whole tree needs to be loaded into memory. In a future update the table will be able to handle lazy loading of nodes using promises.

Within the controller

The controller must implement the applyDropdownFilter function which will be called when the records are generated and filtered. This method doesn't have to be defined. If it is defined, it receives an array of records that match the text filter, and should return an array which has all the custom filtering applied.