麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > JavaScript > 正文

Angular ui.bootstrap.pagination分頁

2019-11-19 17:50:47
字體:
來源:轉載
供稿:網友

本文實例為大家分享了Angular 分頁的具體代碼,供大家參考,具體內容如下

1、Html

<!DOCTYPE html>  <html> <head>  <meta name="viewport" content="width=device-width" />  <title>MyPagination</title>  <link  rel="stylesheet" />  <script src="~/Scripts/angular.js"></script>  <script src="~/Scripts/ui-bootstrap-tpls-0.13.0.min.js"></script>  <script>   var readyDataUrl = '@Url.Content("~/StudentManage/GetPageList")';   var loadDataUrl = '@Url.Content("~/StudentManage/GetPageList")';   var app = angular.module('app', ['ui.bootstrap']);   app.controller('ctrl', ['$log', '$http', '$scope', function ($log, $http, $scope) {    $scope.reportData = [];    $scope.maxSize = 7;    $scope.currentPage = 0;    $scope.totalItems = 0;    $scope.pageChanged = function () {     //showLoading("正在查詢");     $http.post(loadDataUrl, {      pageIndex: $scope.currentPage,      pageSize: 10,      name: ""     })      .then(function (result) {       $scope.reportData = result.data.Data;       $scope.totalItems = result.data.recordTotal;      }).catch(function (error) {       $log.error('error:' + error);      }).finally(function () {       //closeLoading();      });    }    $scope.Inital = function () {     //showLoading("正在查詢");      $http.post(readyDataUrl, {      pageIndex: $scope.currentPage,      pageSize: 10,      name: ""     }).then(function (result) {      $scope.reportData = result.data.Data;      $scope.totalItems = result.data.recordTotal;      //closeLoading();     }).catch(function (error) {      $log.error('error:' + error);     }).finally(function () {      });    }    $scope.Inital();    $scope.search = function () {     //showLoading("正在查詢");     $http.post(loadDataUrl, {})      .then(function (result) {       $scope.reportData = result.data.Data;       $scope.totalItems = result.data.recordTotal;      }).catch(function (error) {       $log.error('error:' + error);      }).finally(function () {       //closeLoading();      });    }   }]);  </script> </head> <body>  <div ng-app="app" ng-controller="ctrl">   <div class="form-group" id="toolbar">    <table>     <tr>      <td style="padding-left:10px;">       <button type="button" class="btn btn-success btn-sm" id="btnSearch" ng-click="search()">查詢</button>      </td>     </tr>    </table>    <div class="bootstrap-table">     <div class="fixed-table-container" style="padding-bottom: 0px;">      <div class="table-responsive">       <table class="table table-condensed table-hover table-striped">        <thead>         <tr>          <th><div class="th-inner">序號</div></th>          <th><div class="th-inner">姓名</div></th>          <th><div class="th-inner">電話</div></th>          <th><div class="th-inner">郵箱</div></th>          <th><div class="th-inner">年齡</div></th>          <th><div class="th-inner">國家</div></th>          <th><div class="th-inner">城市</div></th>         </tr>        </thead>        <tbody>         <tr ng-repeat="o in reportData">          <td><span ng-bind="o.Id"></span></td>          <td><span ng-bind="o.Name"></span></td>          <td><span ng-bind="o.Telephone"></span></td>          <td><span ng-bind="o.Email"></span></td>          <td><span ng-bind="o.Age"></span></td>          <td><span ng-bind="o.Country"></span></td>          <td><span ng-bind="o.City"></span></td>         </tr>        </tbody>       </table>      </div>     </div>    </div>    <pagination class="pagination-sm pull-right"       ng-model="currentPage"       total-items="totalItems"       max-size="7"       ng-change="pageChanged()"       force-ellipses="true"       num-pages="numPages"       boundary-link-numbers="true"       boundary-links="false" @*是否顯示第一個/最后一個按鈕*@       rotate="false"       previous-text="‹"       next-text="›">    </pagination>   </div>  </div> </body> </html> 

2、Action

[HttpPost] public JsonResult GetPageList(int pageIndex, int pageSize, string name) {  int pageCount = 1;  int recordTotal = 0;  int topRecordTotal = 0;  List<Students> list = new List<Students>();  try  {   list = svc.GetAllStudent();   recordTotal = list.Count();   pageCount = (int)Math.Ceiling((decimal)recordTotal / pageSize);   topRecordTotal = (pageIndex - 1 < 0 ? 0 : pageIndex - 1) * pageSize;   list = list.Skip(topRecordTotal).Take(pageSize).ToList();  }  catch (Exception)  {   throw;  }  return Json(new  {   pageIndex = pageIndex,   pageCount = pageCount,   recordTotal = recordTotal,   Data = list,  }, JsonRequestBehavior.AllowGet); } 

效果圖:

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美中文日韩 | 成人男女啪啪免费观看网站四虎 | 成人444kkkk在线观看 | 久久蜜桃精品一区二区三区综合网 | 国语自产免费精品视频在 | av在线免费观看播放 | 欧美黄色一级片在线观看 | xxxxhdhdhdhd日本 | 亚洲综合网站 | 成人综合一区二区 | av成人免费观看 | 4p一女两男做爰在线观看 | 欧美视频一二三区 | 最新av免费网址 | 精品黑人一区二区三区国语馆 | 久久久久av69精品 | 一级成人毛片 | 91短视频网页版 | 国产成人羞羞视频在线 | 免费在线观看成人av | 日韩欧美视频一区二区三区 | 国产精品久久久久久久久久尿 | 黄视频在线网站 | 免费国产一区二区视频 | 亚洲第一成网站 | 爽妇网国产精品 | 中国产一级毛片 | 911视频免费版 | 欧美日韩在线免费观看 | 九九热在线视频免费观看 | 欧美成人性色 | 国内毛片视频 | 97se亚洲综合在线韩国专区福利 | 日本网站一区 | 日本中文字幕电影在线观看 | 久久久久久亚洲综合影院红桃 | 特级毛片a级毛片100免费 | 日日爱99| 久草在线新时代视觉 | 欧美一级全黄 | 特级西西444www大精品视频免费看 |