2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Angular-scrollable-table directive demo</title>
 
    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
        rel="stylesheet" type="text/css">
    <link href='../scrollable-table.css' rel="stylesheet" type="text/css">
    <style type="text/css">
      body {
        margin: 20px;
      }
 
      header, footer {
        margin: 10px 0;
      }
      header label {
        padding-left: 20px;
      }
    </style>
    <script type="text/javascript" src="http://codeorigin.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="http://code.angularjs.org/1.3.9/angular.js"></script>
    <script type="text/javascript" src="../angular-scrollable-table.js"></script>
    <script type="text/javascript" src="app.js"></script>
  </head>
  <body ng-app="myApp" ng-init="rootWidth=600;">
    <div ng-controller="MyCtrl" class="test-container" ng-style="{'width': rootWidth+'px'}">
      <header>
        <button class="btn btn-default" type="button" ng-click="toggleCol()">Toggle column</button>
        <label for="width">Table width: </label>
        <input type="number" step="1" max="1200" min="400" ng-model="rootWidth">
      </header>
      <scrollable-table watch="visibleProjects" resizable>
        <table class="table table-striped table-bordered">
          <thead>
          <tr>
            <th>Facility</th>
            <th sortable-header col="code">Unit code</th>
            <th sortable-header col="cost">Cost</th>
            <th sortable-header col="conditionRating">Condition score</th>
            <th ng-show="toggleColumn" col="extent">Not sortable</th>
            <th sortable-header col="planYear" comparator-fn="comparator">Plan year</th>
          </tr>
          </thead>
          <tbody>
          <tr ng-repeat="response in visibleProjects" row-id="{{ response.facility }}"
            ng-class="{info: selected == response.facility}" >
            <td>{{ response.facility }}</td>
            <td>{{ response.code }}</td>
            <td>{{ response.cost }}</td>
            <td class="cr">{{ response.conditionRating }}</td>
            <td ng-show="toggleColumn">{{ response.extent }}</td>
            <td>{{ response.planYear }}</td>
          </tr>
          </tbody>
        </table>
      </scrollable-table>
      <footer>
        <label>Select a facility:</label>
        <select ng-model="selected" ng-options="f for f in facilities"></select>
      </footer>
    </div>
  </body>
</html>