国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

bootstrap table表格插件使用詳解

2024-05-06 15:17:30
字體:
來源:轉載
供稿:網友

bootstrp-table學習,具體內容如下

$table.bootstrapTable({  url: '../data/data1.json',  striped: true,  minimumCountColumns: 2,  clickToSelect: true,  detailView: true,  detailFormatter: 'detailFormatter',  pagination: true,  paginationLoop: false,  classes: 'table table-hover table-no-bordered',  sidePagination: 'server',  silentSort: false,  queryParamsType:'',  queryParams: queryParams : function(params) {   var subcompany = $('#subcompany option:selected').val();   var name = $('#name').val();       return {   pageNumber: params.offset+1,   pageSize: params.limit,   companyId:subcompany,   name:name   };  },  smartDisplay: false,  idField: 'id',  sortable: false,  escape: true,  idField: 'systemId',  maintainSelected: true,  toolbar: '#toolbar',  columns: [   {field: 'state', checkbox: true},   {field: 'id', title: '編號', sortable: true, halign: 'center'},   {field: 'username', title: '賬號', sortable: true, halign: 'center'},   {field: 'password', title: '密碼', sortable: true, halign: 'center'},   {field: 'name', title: '姓名', sortable: true, halign: 'center'},   {field: 'sex', title: '性別', sortable: true, halign: 'center'},   {field: 'age', title: '年齡', sortable: true, halign: 'center'},   {field: 'phone', title: '手機', sortable: true, halign: 'center'},   {field: 'email', title: '郵箱', sortable: true, halign: 'center'},   {field: 'address', title: '地址', sortable: true, halign: 'center'},   {field: 'remark', title: '備注', sortable: true, halign: 'center'},   {field: 'action', title: '操作', halign: 'center', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}  ] }).on('all.bs.table', function (e, name, args) {  $('[data-toggle="tooltip"]').tooltip();  $('[data-toggle="popover"]').popover();  }); 

bootstrap-table是一種表格插件,可用作后管系統的數據處理和回顯,當然,bootstrap-table的使用需要前后臺協調進行。

在使用bootstrap-table過程中需要注意:

  接口返回數據格式[json]包含的兩個字段: total(數據總計)與rows(數據),即{"total":24,"rows":[...]}

  分頁包括服務器端和客戶端兩種情況,務器端分頁的參數默認值為limit,offset,search,sort,order Else,通過queryParamsType參數可對其進行重寫

  columns字段中:file 表示返回字段的屬性名;title表示th標題內容;formatter表示自定義列表顯示內容,包含三個參數,value, row, index,對應 為file值,行數據,行數

function actionFormatter(value, row, index) { return [   '<a class="like" href="detail.html" rel="external nofollow" data-toggle="tooltip" title="詳情"><i class="glyphicon glyphicon-pencil"></i></a> ',  '<a class="edit ml10" href="javascript:createAction()" rel="external nofollow" data-toggle="tooltip" title="修改密碼"><i class="glyphicon glyphicon-edit"></i></a> ', ].join('');}            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 廊坊市| 阜新市| 盐源县| 鸡泽县| 邛崃市| 囊谦县| 灯塔市| 长沙县| 苗栗县| 合水县| 赤峰市| 黄陵县| 凉山| 临清市| 南宁市| 周宁县| 宾阳县| 泰兴市| 昭平县| 锡林郭勒盟| 武宣县| 和平区| 嘉峪关市| 武穴市| 尖扎县| 壶关县| 五河县| 石阡县| 丰镇市| 方城县| 旺苍县| 县级市| 大关县| 西平县| 雅江县| 阜城县| 镇坪县| 呼伦贝尔市| 宁安市| 云南省| 常州市|