Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ziscloud committed Sep 29, 2014
1 parent fa2ba7a commit 1a5de34
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,43 +66,43 @@ angular
```
* custom filter
* in the view
```html
<select class="filter-status" ng-model='filter.status' ng-change="filterByStatus()">
<option></option>
<option value="active">Active</option>
<option value="disabled">Disabled</option>
<option value="suspended">Suspended</option>
</select>
<a href="#clear" class="clear-filter" title="clear filter" ng-click="clearFilter()">[clear]</a>
<table class="table footable" data-before-filtering="filteringEventHandler">
```
```html
<select class="filter-status" ng-model='filter.status' ng-change="filterByStatus()">
<option></option>
<option value="active">Active</option>
<option value="disabled">Disabled</option>
<option value="suspended">Suspended</option>
</select>
<a href="#clear" class="clear-filter" title="clear filter" ng-click="clearFilter()">[clear]</a>
<table class="table footable" data-before-filtering="filteringEventHandler">
```
* in the controller
```javascript
.controller('exampleCtrl', function($scope) {
$scope.clearFilter = function() {
$('.filter-status').val('');
$('.footable').trigger('footable_clear_filter');
};

$scope.filteringEventHandler = function(e) {
var selected = $('.filter-status').find(':selected').text();
if (selected && selected.length > 0) {
e.filter += (e.filter && e.filter.length > 0) ? ' ' + selected : selected;
e.clear = !e.filter;
}
};

$scope.filterByStatus = function() {
$('.footable').trigger('footable_filter', {
filter: $('#filter').val()
});
};

$scope.filter = {
status: null
};
})
```
```javascript
.controller('exampleCtrl', function($scope) {
$scope.clearFilter = function() {
$('.filter-status').val('');
$('.footable').trigger('footable_clear_filter');
};
$scope.filteringEventHandler = function(e) {
var selected = $('.filter-status').find(':selected').text();
if (selected && selected.length > 0) {
e.filter += (e.filter && e.filter.length > 0) ? ' ' + selected : selected;
e.clear = !e.filter;
}
};
$scope.filterByStatus = function() {
$('.footable').trigger('footable_filter', {
filter: $('#filter').val()
});
};
$scope.filter = {
status: null
};
})
```
#### paginating
paginate table is very easy, follow the demo page of footable is enough
* load foot.paginate.js into your app
Expand Down

0 comments on commit 1a5de34

Please sign in to comment.