Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dalelotts/angular-sortable-column
This angular directive emulates the Grails sortableColumn tag.
https://github.com/dalelotts/angular-sortable-column
Last synced: 29 days ago
JSON representation
This angular directive emulates the Grails sortableColumn tag.
- Host: GitHub
- URL: https://github.com/dalelotts/angular-sortable-column
- Owner: dalelotts
- License: mit
- Created: 2013-08-27T22:48:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-02T03:08:54.000Z (over 10 years ago)
- Last Synced: 2024-10-09T22:51:15.428Z (about 1 month ago)
- Language: JavaScript
- Size: 174 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Angular sortable column 0.1.4
================================Native AngularJS sortable column directive that is modeled after the [Grails sortableColumn tag] (http://grails.org/doc/latest/ref/Tags/sortableColumn.html)
[![Build Status](https://travis-ci.org/dalelotts/angular-sortable-column.png?branch=master)](https://travis-ci.org/dalelotts/angular-sortable-column)
#Dependencies
Requires:
* AngularJS 1.1.3 or higher (Not tested with 1.0.x)
* jQuery 1.10.2 or higher (Would like to remove this dependency)#Testing
We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:```
npm install -g grunt-cli
npm install bower grunt
```The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in test\test.config.js
#Usage
We use bower for dependency management. Add```json
dependencies: {
"angular-sortable-column": "latest"
}
```To your bower.json file. Then run
```html
bower install
```This will copy the angular-sortable-column files into your components folder, along with its dependencies.
Load the script files in your application:
```html```
Add the date module as a dependency to your application module:
```html
var myAppModule = angular.module('MyApp', ['ui.sortableColumn'])
```Apply the directive to your form elements:
```html
```
## Options
### defaultOrder
String.
Required
Default: 'asc'The default sort order for the column.
Accepts values of :
* 'asc' for ascending order
* 'desc' for descending order### exclude
String array.
Optional
Default: []Array of route parameters that should be excluded from the link paramaters.
This is useful when using parametrized routes. i.e. .when( '/customer/:id' ... ) exclude 'id' so id=x is not one of the url paramters.### params
Object.
Optional
default: {}An object containing additional request parameters.
### prefix
String.
Optional
default: '#'Prefix the generated url with this value.
### property
String.
Required
default: undefinedName of the property relating to the column to sort
### title
String.
Required
default: undefinedThe title caption for the column.
## Examples
```html
```
will result in an initial value of
```html
```
However, if the route is '#/[$location.path()]?sort=bar&order=asc'
```html
```
Note that the order in the link is different than the current order
and that the 'sorted' and 'asc' classes were added to the 'th' element