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

angular-table-tools

v2.0.5

Published

AngularJS TableTools Plugin

Downloads

9

Readme

AngularJS TableTools Plugin

Plugin that makes working with tables easier. Through various set of directives it enables you to easily create a pagination, sort table data, filter it and many more.

It uses Twitter Bootstrap and Font Awesome for better presentation.

See Live Demo for an example.

Prerequisites

Installation

yarn add angular-table-tools
yarn install

Configuration

Language strings and other defaults are configurable through the tableTools provider.

angular.module('...').config(['tableToolsProvider', function(tableToolsProvider){
	tableToolsProvider.perPage = 10;
}]);

Usage

See Live Demo and its source code to better understand all of available directives and its usage.

Basic usage

Create a container with table-tools directive inside which you will be able to work with table data. Bind an array of table data to the directive. Table data should be an array of objects.

TableTools controller is bound to the new scope created by directive in tableTools variable. Filtered data is available through tableTools.data variable.

<div table-tools="tableData">
	<div ng-repeat="d in tableTools.data">
		{{d}}
	</div>
</div>

You can change the default order of data using order="field" directive. Field is the key in each object of tableData, by which the data will be ordered. Use -field for descending order.

You can change number of rows per page and allowed per-page options using per-page and per-page-options directives.

Sorting

Use sort="field_name" directive on column headers to enable column sorting. Order will be changed on click. Clicking with shift key enables sorting by multiple columns.

Data filtering

Use tt-search directive to create a search component (input). Typing text inside it will filter the data leaving only rows that match given search string (row is match if any of its object values matches the search string).

You can create data filters with tt-filter="field_name" directive. It requires an ng-model which value would be used to filter the data. If tt-filter element has an value directive, it will be used instead of ng-model (ie. for checkboxes).

tt-filter accepts some options through other directives:

  • tt-filter-empty="" - if filter value matches tt-filter-empty value, this filter will be skipped
  • tt-filter-operator="" - change the default (==) operator used for comparison, available operators are:
    • ==
    • >=
    • <=
    • >
    • <
    • like
  • tt-filter-or - if any other filter bound to the same field_name is matched, this filter will pass too

Pagination

Use pagination directive to create pagination compontent.

Use tt-per-page directive to create a component that allows user to change default results per page number.

Select rows

You can use tt-select="rowItem" directive inside each row to create a checkbox that allows user to select given row.

Use tt-select-all directive to create a checkbox that selects/deselects all checkboxes created by tt-select.

Use tt-selected-click="callbackFunction" to do something with selected rows. callbackFunction will be called with an array of selected rows.

Export (requires angularjs-bootstrap)

Use tt-export directive to create a component that allows user to easily export currently visible data. Export takes data from HTML, so its exported in a format that is visible in browser.

Server-side processing

Use tt-url="http://some/url" to process data on server-side.