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-resize

v2.0.1

Published

An AngularJS module for resizing table columns!

Downloads

3,223

Readme

angular-table-resize

An AngularJS module for resizing table columns!

Demo

You can try out a demo by clicking here. You can also use the demo as an example for implementing the module on your own page. The source can be found in the gh-pages branch

Installation

Bower

bower install angular-table-resize

NPM

npm install angular-table-resize

Quick Setup

Link style sheets

<link rel="stylesheet" href="angular-table-resize.css">

Import dependencies

<script src="jquery.js"></script>
<script src="angular.js"></script>

Import the module

<script src="angular-table-resize.js"></script>

Install the module

Add the module to your application

angular.module('myApplication', ['rzTable']);

On a HTML table tag put the rz-table directive

<table rz-table>...</table>

That wasn't so hard was it now?

Attributes

  • rz-mode Changes the resizing mode of the module (see resizing modes). Two-way-binding to a string, that is the name of the resizer you want to use.

  • rz-save Two-way-binding to boolean variable. Whether or not to save the column sizes in local storage (see local storage). Default is true.

  • rz-busy Two-way-binding to boolean variable. As long as the value is true, the table will not be initialised. Can be used to postpone initialisation until other components has been initialised. Should only be used in special case scenarios.

  • rz-options Two-way-binding to an object literal with optional/additional options (see options)

  • rz-model Two-way-binding to a variable on the controller scope. The variable will be overwritten with an object literal, where you can access utility functions (see utilities).

  • rz-profile Two-way-binding to a string which is a unique identifier for the currently active profile. Default is the default profile (the empty string).

  • rz-container A string which is the query selector for the container of the table. Default is the parent element of the table.

Local Storage

The module automatically saves the current column widths to localStorage. This however requires that you supply your <table> an id and all of your table headers (<th>) with an id as well. Otherwise you should set rz-save to false. For dynamic tables you should use the rz-col directive (see dynamic tables).

Dynamic Tables

If you are generating your columns dynamically (e.g. using ng-repeat) you should instead of using an id for your table headers (<th>) use the rz-col directive. Remember that your table must still have an id for local storage to work.

Example:

<table rz-table id="myTable">
  <thead>
    <th ng-repeat="col in columns" rz-col="col"></th>
  </thead>
  ...
</table>

The rz-col directive is a two-way-binding to a string, which is the id for that column.

Resizing Modes

The resize mode can be set to any of the following modes. You may also chose to allow the enduser to chose from the below by binding rz-mode to a scope variable. Choose the one that works best for you in practice.

| Resize Mode | Description | | :---------------- |:--------------| | BasicResizer | Only the two adjecent cell are resized when dragging a handler. Cell widths are always in percentage | | FixedResizer | First columns is width auto. Subsequent column sizes are never changed after resizing | | OverflowResizer | Table may expand out of its container, adding scrollbars. Columns are always the same size after resizing |

Custom Stylesheets

If you want to use your own stylesheets in favor of the minimalistic angular-table-resize.css provided by the module you may do so. You can style the existing classes, or you can overwrite the default classnames (see tableClass, handleClass and handleClassActive). You must keep in mind that the module works best with tables which has the following styles set for the <table> element:

 table-layout: fixed;
 border-collapse: collapse;

Utilities

  • reset() Resets the currently active resizing profile and deletes it from local storage. Column sizes will be reset to default.

  • clearStorage() Clears all profiles saved in local storage - but does not change/reset the current column widths. You may optionally call reset() afterwards if you wish to do so.

  • clearStorageActive() Clears the currently active profile from local storage - but does not change/reset the current column widths. Use reset() instead if you want to do so.

  • update() Re-initializes the module. Be aware that the module will update itself automatically when you change any of the attributes of the module. You should have a good reason to use this function.

Options

You may supply optional/additional options to the module for your personalization:

  • onResizeStarted: function(column) Callbacks functio. Called when a column has been started resizing

  • onResizeEnded: function(column) Callback function. Called when resizing a column has ended

  • onResizeInProgress: function(column, newWidth, diffX) Callback function. Called for every tick in the resizing process.

  • tableClass: string The class appended to the table for styling purposes. Default is rz-table (from angular-table-resize.css).

  • handleClass: string The class appended to handles for styling purposes. Default is rz-handle (from angular-table-resize.css).

  • handleClassActive: string The class appended to the handle, when a column is being resized. Default is rz-handle-active (from angular-table-resize.css).