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

首頁(yè) > 編程 > JavaScript > 正文

Bootstrap Table使用整理(二)

2019-11-19 16:22:55
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

相關(guān)閱讀:

Bootstrap Table使用整理(一) //www.survivalescaperooms.com/article/115789.htm

Bootstrap Table使用整理(三)  //www.survivalescaperooms.com/article/115795.htm

Bootstrap Table使用整理(四)之工具欄 //www.survivalescaperooms.com/article/115798.htm

Bootstrap Table使用整理(五)之分頁(yè)組合查詢 //www.survivalescaperooms.com/article/115785.htm

一、行樣式修改

<table id="table1"   data-row-style="rowStyle"></table> /* * data-row-style 擴(kuò)展方法處理 行樣式 */ $('#table1').bootstrapTable({  columns: [   { field: 'sno', title: '學(xué)生編號(hào)' },   { field: 'sname', title: '學(xué)生姓名' },   { field: 'ssex', title: '性別' },   { field: 'sbirthday', title: '生日' },   { field: 'class', title: '課程編號(hào)' },  ],  url:'@Url.Action("GetStudent","DataOne")' }); /**  *  * @@param row 當(dāng)前行數(shù)據(jù)對(duì)象  * @@param index 當(dāng)前行索引  */ function rowStyle(row, index) {  var classes = ['active', 'success', 'info', 'warning', 'danger'];  if (row.sno.indexOf('2') != -1) {   return {    classes:['success']   }  }  return {}; } 

二、單元格樣式定義,對(duì)齊方式定義

/* * data-cell-style 擴(kuò)展方法處理 單元格樣式 * data-align 設(shè)置當(dāng)前列的對(duì)齊方式,包括表頭 * data-halign 設(shè)置表格標(biāo)題的對(duì)齊方式,優(yōu)先級(jí)大于 align */ $('#table1').bootstrapTable({  columns: [   {    field: 'sno', title: '學(xué)生編號(hào)',    align: 'center',    halign:'right',    cellStyle: function (value, row, index) {     //當(dāng)前列,奇數(shù)單元格顯示綠色     if (index%2==0)      return {       classes: 'success'      };      return {};    }   },   { field: 'sname', title: '學(xué)生姓名' },   { field: 'ssex', title: '性別' },   { field: 'sbirthday', title: '生日' },   { field: 'class', title: '課程編號(hào)' },  ],  url:'@Url.Action("GetStudent","DataOne")' }); 

三、排序列定義

/* * data-sortable 設(shè)置當(dāng)前列是否可排序,默認(rèn)當(dāng)前顯示內(nèi)容排序 * data-sort-name 設(shè)置默認(rèn)排序列名 * data-sort-order 設(shè)置默認(rèn)排序方式 asc/desc * data-sorter 可以自定義擴(kuò)展排序方法 */ $('#table1').bootstrapTable({  columns: [   { field: 'sno', title: '學(xué)生編號(hào)', sortable: true },   { field: 'sname', title: '學(xué)生姓名', sortable: true},   { field: 'ssex', title: '性別', sortable: true },   { field: 'sbirthday', title: '生日', sortable: true},   { field: 'class', title: '課程編號(hào)', sortable: true},  ],  url:'@Url.Action("GetStudent","DataOne")' }); <table id="table1"   data-classes="table table-hover table-condensed"   data-sort-name="sno"   data-sort-order="desc"></table> 

以上所述是小編給大家介紹的Bootstrap Table使用整理(二),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)武林網(wǎng)網(wǎng)站的支持!

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 田林县| 瑞安市| 和田县| 自治县| 民丰县| 德江县| 商河县| 乌兰察布市| 宁城县| 五指山市| 宾阳县| 贵德县| 城市| 台中县| 乌审旗| 北安市| 东台市| 达拉特旗| 福贡县| 汉源县| 宁国市| 三原县| 沛县| 大荔县| 渭南市| 和平县| 神木县| 日喀则市| 镇原县| 衡水市| 景东| 天气| 安康市| 永康市| 保定市| 开远市| 河北区| 五台县| 突泉县| 贺兰县| 城固县|