Bootstrap中Table使用整理之工具欄的示例分析

這篇文章將為大家詳細(xì)講解有關(guān)Bootstrap中Table使用整理之工具欄的示例分析,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)是一家專業(yè)提供北川羌族企業(yè)網(wǎng)站建設(shè),專注與成都做網(wǎng)站、成都網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為北川羌族眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。

一、啟用默認(rèn)支持的工具欄

/* 
* data-search 是否顯示搜索框 
* data-show-refresh 是否像是刷新按鈕,注:刷新操作會(huì)重新請(qǐng)求數(shù)據(jù),并帶著請(qǐng)求參數(shù) 
* data-show-toggle 是否顯示面板切換按鈕 
* data-show-columns 是否顯示列控制按鈕 
*/ 
$('#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")' 
}); 
<table id="table1" 
 data-classes="table table-hover " 
 data-search="true" 
 data-show-refresh="true" 
 data-show-toggle="true" 
 data-show-columns="true"></table>

Bootstrap中Table使用整理之工具欄的示例分析

二、擴(kuò)展工具欄使用

/* 
* data-toolbar 用于指定id的div擴(kuò)展工具欄,這種方式類似EaseUI中的datagird 
* queryParams 請(qǐng)求服務(wù)器數(shù)據(jù)時(shí),你可以通過(guò)重寫參數(shù)的方式添加一些額外的參數(shù),例如 toolbar 中的參數(shù) 如果 queryParamsType = 'limit' ,返回參數(shù)必須包含 
  limit, offset, search, sort, order 否則, 需要包含: 
  pageSize, pageNumber, searchText, sortName, sortOrder. 
  返回false將會(huì)終止請(qǐng)求 
*/ 
var $table1= $('#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")', 
 queryParams: function (params) { 
 params.name = '張三豐'; 
 //特別說(shuō)明,返回的參數(shù)的值為空,則當(dāng)前參數(shù)不會(huì)發(fā)送到服務(wù)器端 
 params.sex = $('input[name="sex"]:checked').val(); 
 return params; 
 } 
}); 
//刷新方法 
$('#heartBtn').click(function () { 
 ////刷新處理,指定query 的參數(shù),注:此地方指定的參數(shù),僅在當(dāng)次刷新時(shí)使用 
 //$table1.bootstrapTable('refresh', { 
 // query: { 
 // name: '張三' 
 // } 
 //}); 
 $table1.bootstrapTable('refresh'); 
}); 
<table id="table1" 
 data-classes="table table-hover " 
 data-search="true" 
 data-show-refresh="true" 
 data-show-toggle="true" 
 data-show-columns="true" 
 data-toolbar="#toolbar"></table> 
<div id="toolbar"> 
 <div class="btn-group"> 
 <button class="btn btn-default"> 
  <i class="glyphicon glyphicon-plus"></i> 
 </button> 
 <button class="btn btn-default"> 
  <i class="glyphicon glyphicon-heart" id="heartBtn"></i> 
 </button> 
 <button class="btn btn-default"> 
  <i class="glyphicon glyphicon-trash"></i> 
 </button> 
 </div> 
 <div class="form-group"> 
 <label class="control-label">性別:</label> 
 <label class="radio-inline"> 
  <input type="radio" name="sex" value="男" /> 男 
 </label> 
 <label class="radio-inline"> 
  <input type="radio" name="sex" value="女" /> 女 
 </label> 
 </div> 
</div>

Bootstrap中Table使用整理之工具欄的示例分析

關(guān)于“Bootstrap中Table使用整理之工具欄的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

分享文章:Bootstrap中Table使用整理之工具欄的示例分析
網(wǎng)頁(yè)路徑:http://bm7419.com/article10/ipodgo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、定制網(wǎng)站外貿(mào)建站、面包屑導(dǎo)航、微信公眾號(hào)Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作