mirror of
https://github.com/gwenhael-le-moine/ledgerrb.git
synced 2025-01-26 07:58:10 +01:00
ng-table parameters
This commit is contained in:
parent
fb034100e5
commit
8094fc839c
2 changed files with 17 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
app.controller( 'BalanceCtrl',
|
||||
[ '$scope', '$http', '$filter',
|
||||
function( $scope, $http, $filter ) {
|
||||
[ '$scope', '$http', '$filter', 'ngTableParams',
|
||||
function( $scope, $http, $filter, ngTableParams ) {
|
||||
$scope.now = moment();
|
||||
$scope.previous_period = function() {
|
||||
$scope.now.subtract( 'months', 1 );
|
||||
|
@ -62,6 +62,15 @@ app.controller( 'BalanceCtrl',
|
|||
};
|
||||
};
|
||||
|
||||
$scope.tableParams = new ngTableParams( { page: 1, // show first page
|
||||
count: 999 // count per page
|
||||
},
|
||||
{ counts: [], // hide page counts control
|
||||
total: 1, // value less than count hide pagination
|
||||
getData: function($defer, params) {
|
||||
$defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
||||
} } );
|
||||
|
||||
var retrieve_data = function() {
|
||||
$scope.balance = { expenses: [],
|
||||
income: [],
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
</nvd3-pie-chart>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<table ng-table="tableParams" class="table">
|
||||
<tr ng-repeat="account in balance.expenses">
|
||||
<table data-ng-table="tableParams" class="table">
|
||||
<tr data-ng-repeat="account in balance.expenses">
|
||||
<td data-title="'Account'">{{account.account}}</td>
|
||||
<td data-title="'Amount'">{{account.amount}} €</td>
|
||||
<td data-title="'Amount'">{{account.amount | number:2}} €</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -71,10 +71,10 @@
|
|||
</nvd3-pie-chart>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<table ng-table="tableParams" class="table">
|
||||
<tr ng-repeat="account in balance.income">
|
||||
<table data-ng-table="tableParams" class="table">
|
||||
<tr data-ng-repeat="account in balance.income">
|
||||
<td data-title="'Account'">{{account.account}}</td>
|
||||
<td data-title="'Amount'">{{account.amount}} €</td>
|
||||
<td data-title="'Amount'">{{account.amount | number:2}} €</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue