-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of custom header
- Loading branch information
Showing
8 changed files
with
146 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<!DOCTYPE html> | ||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | ||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | ||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<meta name="viewport" content="width=device-width"> | ||
|
||
<link rel="stylesheet" href="css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="css/bootstrap-theme.min.css"> | ||
<!--[if lt IE 9]> | ||
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> | ||
<![endif]--> | ||
<script src="js/angular.min.js"></script> | ||
<script src="../ng-table.src.js"></script> | ||
<link rel="stylesheet" href="../ng-table.css"> | ||
</head> | ||
<body ng-app="main"> | ||
<h1>Custom header</h1> | ||
|
||
<div ng-controller="DemoCtrl"> | ||
|
||
<table ng-table="tableParams" class="table"> | ||
<thead> | ||
<tr> | ||
<th class="sortable" ng-class="{ | ||
'sort-asc': tableParams.isSortBy('name', 'asc'), | ||
'sort-desc': tableParams.isSortBy('name', 'desc') | ||
}" | ||
ng-click="tableParams.sorting({'name' : tableParams.isSortBy('name', 'asc') ? 'desc' : 'asc'})" rowspan="2"> | ||
<div><i class="glyphicon glyphicon-user"></i> Name</div> | ||
</th> | ||
<th colspan="2" class="text-center">Data</th> | ||
</tr> | ||
<tr> | ||
<th class="text-center sortable" ng-class="{ | ||
'sort-asc': tableParams.isSortBy('age', 'asc'), | ||
'sort-desc': tableParams.isSortBy('age', 'desc') | ||
}" | ||
ng-click="tableParams.sorting({'age' : tableParams.isSortBy('age', 'asc') ? 'desc' : 'asc'})"> | ||
<div>Age</div> | ||
</th> | ||
<th class="text-center">etc...</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="user in $data"> | ||
<td data-title="'Name'" sortable="name"> | ||
{{user.name}} | ||
</td> | ||
<td data-title="'Age'" width="200"> | ||
{{user.age}} | ||
</td> | ||
<td data-title="'With default braces'" width="200"> | ||
{{user.age}} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<script> | ||
var app = angular.module('main', ['ngTable']) | ||
.controller('DemoCtrl', function($scope, ngTableParams, $filter) { | ||
var data = [{name: "Moroni", age: 50}, | ||
{name: "Tiancum", age: 43}, | ||
{name: "Jacob", age: 27}, | ||
{name: "Nephi", age: 29}, | ||
{name: "Enos", age: 34}, | ||
{name: "Tiancum", age: 43}, | ||
{name: "Jacob", age: 27}, | ||
{name: "Nephi", age: 29}, | ||
{name: "Enos", age: 34}, | ||
{name: "Tiancum", age: 43}, | ||
{name: "Jacob", age: 27}, | ||
{name: "Nephi", age: 29}, | ||
{name: "Enos", age: 34}, | ||
{name: "Tiancum", age: 43}, | ||
{name: "Jacob", age: 27}, | ||
{name: "Nephi", age: 29}, | ||
{name: "Enos", age: 34}]; | ||
|
||
$scope.tableParams = new ngTableParams({ | ||
page: 1, // show first page | ||
count: 10 // count per page | ||
}, { | ||
total: data.length, // length of data | ||
getData: function($defer, params) { | ||
// use build-in angular filter | ||
var orderedData = params.sorting() ? | ||
$filter('orderBy')(data, params.orderBy()) : | ||
data; | ||
|
||
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count())); | ||
} | ||
}); | ||
}); | ||
</script> | ||
|
||
</div> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters