AngularJS的数据表格
需要使用angualarjs、bootstrap、dirPagination.js
效果图:

1.html部分
04 | <meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" /> |
05 | <title>angularjs的数据表格</title> |
06 | <link rel= "stylesheet" href= "css/bootstrap-3.0.0/css/bootstrap.css" rel= "external nofollow" /> |
07 | <link href= "css/special.css" rel= "external nofollow" rel= "stylesheet" /> |
08 | <script src= "js/angular-1.3.0.js" ></script> |
09 | <script src= "vendor/dirPagination.js" ></script> |
10 | <script src= "js/app/angularjsTable.js" ></script> |
13 | <form ng-controller= "tableCtrl as aly" > |
14 | <div class= "sp-page-content" > |
15 | <div class= "sp-page-title" > |
18 | <table class= "sp-grid" > |
21 | <th style= "width: 20%;" >应用代码</th> |
22 | <th style= "width: 20%;" >应用名称</th> |
23 | <th style= "width: 20%;" >版本</th> |
24 | <th style= "width: 20%;" >状态</th> |
25 | <th style= "width: 20%;" >操作</th> |
28 | <tbody id= "myApplyTable" > |
29 | <tr ng-show= "aly.users.length <= 0" > |
30 | <td colspan= "5" style= "text-align: center;" >还没有数据</td> |
32 | <tr dir-paginate= "user in aly.users|itemsPerPage:aly.itemsPerPage" total-items= "aly.total_count" > |
33 | <td>{{user.code}}</td> |
34 | <td>{{user.name}}</td> |
35 | <td>{{user.version}}</td> |
36 | <td>{{user.status}}</td> |
38 | <a class= "sp-color-blue" >安 装</a>| |
39 | <a class= "sp-color-green" >查 看</a> |
47 | <td><a ui-sref= "app.apply_view" class= "ligblue" >查 看</a></td> |
51 | <dir-pagination-controls max-size= "8" |
52 | direction-links= "true" |
54 | on-page-change= "aly.getData(newPageNumber)" > |
55 | </dir-pagination-controls> |
2.angularjsTable.js部分
02 | var app = angular.module( 'app' , [ |
03 | 'angularUtils.directives.dirPagination' |
05 | app.controller( 'tableCtrl' , [ '$http' , function ($http) { |
11 | self.itemsPerPage = 10; |
12 | self.getData = function (pageno) { |
18 | url: 'json/myApply.txt' , |
19 | data: { pagesize: self.itemsPerPage, pageno: self.pageno } |
20 | }).success( function (response) { |
21 | self.users = response.data; |
22 | self.total_count = response.total_count; |
25 | self.getData(self.pageno); |
3.json数据部分 myApply.txt
以上所述是小编给大家介绍的Angualrjs和bootstrap相结合实现数据表格table,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!