Skip to content

Commit

Permalink
update demos and demo site
Browse files Browse the repository at this point in the history
  • Loading branch information
esvit committed Oct 26, 2013
1 parent 2ed3bf9 commit 40f9d61
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 41 deletions.
44 changes: 19 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,22 @@ bower install ng-table

## Examples (from simple to complex)

* [Pagination](http://esvit.github.io/ng-table/#!/demo1)
* [Sorting](http://esvit.github.io/ng-table/#!/demo3)
* [Filtering](http://esvit.github.io/ng-table/#!/demo4)
* [Cell template](http://esvit.github.io/ng-table/#!/demo8)
* [Row template](http://esvit.github.io/ng-table/#!/demo9)
* [Params in url](http://esvit.github.io/ng-table/#!/demo5)
* [Ajax](http://esvit.github.io/ng-table/#!/demo6)
* [Custom template(pagination)](http://esvit.github.io/ng-table/#!/demo2)
* [Custom filters](http://esvit.github.io/ng-table/#!/demo11)
* [Table with checkboxes](http://esvit.github.io/ng-table/#!/demo10)

## Usage
```html
<table ng-table="tableParams" show-filter="true">
<tr ng-repeat="user in users">
<!-- IMPORTANT: String titles must be in single quotes -->
<td data-title="'Name of person'" filter="{ 'name': 'text' }" sortable="name">
{{user.name}}
</td>
<td data-title="'Age'" filter="{ 'action': 'button' }" sortable="age">
{{user.age}}
</td>
</tr>
</table>
```
* [Pagination](http://bazalt-cms.com/ng-table/example/1)
* [Sorting](http://bazalt-cms.com/ng-table/example/3)
* [Filtering](http://bazalt-cms.com/ng-table/example/4)
* [Cell template](http://bazalt-cms.com/ng-table/example/8)
* [Row template](http://bazalt-cms.com/ng-table/example/9)
* [Params in url](http://bazalt-cms.com/ng-table/example/5)
* [Ajax](http://bazalt-cms.com/ng-table/example/6)
* [Custom template(pagination)](http://bazalt-cms.com/ng-table/example/2)
* [Custom filters](http://bazalt-cms.com/ng-table/example/11)
* [Table with checkboxes](http://bazalt-cms.com/ng-table/example/10)

#### PS
Let me know if you are using **ng-table**. It will motivate me to work harder.
And if you like **ng-table**, just email me and add your website [here](https://bazalt-cms.com/ng-table/who-is-using)
Hope you like it, Thanks! :)

---

This project is part of [Bazalt CMS](http://bazalt-cms.com/).
15 changes: 13 additions & 2 deletions examples/demo10.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,23 @@ <h1>Table with checkboxes</h1>
}
});

var inArray = Array.prototype.indexOf ?
function (val, arr) {
return arr.indexOf(val)
} :
function (val, arr) {
var i = arr.length;
while (i--) {
if (arr[i] === val) return i;
}
return -1
};
$scope.names = function(column) {
var def = $q.defer(),
arr = [],
names = [];
angular.forEach(data, function(item){
if ($.inArray(item.name, arr) === -1) {
if (inArray(item.name, arr) === -1) {
arr.push(item.name);
names.push({
'id': item.name,
Expand Down Expand Up @@ -121,7 +132,7 @@ <h1>Table with checkboxes</h1>
$scope.checkboxes.checked = (checked == total);
}
// grayed checkbox
$("#select_all").prop("indeterminate", (checked != 0 && unchecked != 0));
angular.element(document.getElementById("select_all")).prop("indeterminate", (checked != 0 && unchecked != 0));
}, true);
})
</script>
Expand Down
13 changes: 12 additions & 1 deletion examples/demo11.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,23 @@ <h1>Custom filters</h1>
}
});

var inArray = Array.prototype.indexOf ?
function (val, arr) {
return arr.indexOf(val)
} :
function (val, arr) {
var i = arr.length;
while (i--) {
if (arr[i] === val) return i;
}
return -1
};
$scope.names = function(column) {
var def = $q.defer(),
arr = [],
names = [];
angular.forEach(data, function(item){
if ($.inArray(item.name, arr) === -1) {
if (inArray(item.name, arr) === -1) {
arr.push(item.name);
names.push({
'id': item.name,
Expand Down
2 changes: 1 addition & 1 deletion ng-table.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40f9d61

Please sign in to comment.