Bootstrap Table使用整理(四)之工具欄
相關(guān)閱讀:
Bootstrap Table使用整理(一) http://www.dhdzp.com/article/115789.htm
Bootstrap Table使用整理(二) http://www.dhdzp.com/article/115791.htm
Bootstrap Table使用整理(三) http://www.dhdzp.com/article/115795.htm
Bootstrap Table使用整理(五)之分頁(yè)組合查詢 http://www.dhdzp.com/article/115785.htm
一、啟用默認(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>

二、擴(kuò)展工具欄使用
/*
* data-toolbar 用于指定id的div擴(kuò)展工具欄,這種方式類似EaseUI中的datagird
* queryParams 請(qǐng)求服務(wù)器數(shù)據(jù)時(shí),你可以通過(guò)重寫(xiě)參數(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使用整理(四)之工具欄,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- Bootstrap Table使用整理(三)
- Bootstrap Table使用整理(二)
- Bootstrap Table使用整理(一)
- Bootstrap Table使用整理(五)之分頁(yè)組合查詢
- BootstrapTable refresh 方法使用實(shí)例簡(jiǎn)單介紹
- Bootstrap table使用方法詳細(xì)介紹
- 值得分享的Bootstrap Table使用教程
- DataTables+BootStrap組合使用Ajax來(lái)獲取數(shù)據(jù)并且動(dòng)態(tài)加載dom的方法(排序,過(guò)濾,分頁(yè)等)
- BootStrap table使用方法分析
相關(guān)文章
判斷數(shù)組是否包含某個(gè)元素的js函數(shù)實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇判斷數(shù)組是否包含某個(gè)元素的js函數(shù)實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
史上最全JavaScript數(shù)組去重的十種方法(推薦)
這篇文章主要介紹了JavaScript數(shù)組去重的十種方法,利用元素的屬性和特性進(jìn)行不同的去重方法,并實(shí)例演示如何測(cè)試去重超大數(shù)組,具體操作步驟大家可查看下文的詳細(xì)講解,感興趣的小伙伴們可以參考一下。2017-08-08
Bootstrap彈出框modal上層的輸入框不能獲得焦點(diǎn)問(wèn)題的解決方法
這篇文章主要介紹了Bootstrap彈出框modal上層的輸入框不能獲得焦點(diǎn)問(wèn)題的解決方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
JS實(shí)現(xiàn)兼容性好,帶緩沖的動(dòng)感網(wǎng)頁(yè)右鍵菜單效果
這篇文章主要介紹了JS實(shí)現(xiàn)兼容性好,帶緩沖的動(dòng)感網(wǎng)頁(yè)右鍵菜單效果,可實(shí)現(xiàn)帶有彈性效果并且能夠自定義鼠標(biāo)事件的右鍵菜單功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-09-09
微信小程序的引導(dǎo)頁(yè)實(shí)現(xiàn)代碼
這篇文章主要介紹了微信小程序的引導(dǎo)頁(yè)實(shí)現(xiàn)代碼,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-06-06
JavaScript數(shù)組Array的一些常用方法總結(jié)
JavaScript的Array對(duì)象是用于構(gòu)造數(shù)組的全局對(duì)象,數(shù)組是類似于列表的高階對(duì)象,下面這篇文章主要給大家介紹了關(guān)于JavaScript數(shù)組Array的一些常用方法,需要的朋友可以參考下2021-11-11
JavaScript console的使用方法實(shí)例分析
這篇文章主要介紹了JavaScript console的使用方法,結(jié)合實(shí)例形式分析了JavaScript console的使用方法與操作注意事項(xiàng),需要的朋友可以參考下2020-04-04
Javascript中克隆一個(gè)數(shù)組的實(shí)現(xiàn)代碼
這篇文章主要是對(duì)在Javascript中克隆一個(gè)數(shù)組的實(shí)現(xiàn)代碼進(jìn)行了介紹。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-12-12
JS實(shí)現(xiàn)DOM刪除節(jié)點(diǎn)操作示例
這篇文章主要介紹了JS實(shí)現(xiàn)DOM刪除節(jié)點(diǎn)操作,結(jié)合實(shí)例形式分析了javascript使用removeChild()操作頁(yè)面dom節(jié)點(diǎn)刪除功能的相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-04-04
javascript自然分類法算法實(shí)現(xiàn)代碼
這篇文章介紹了javascript自然分類法算法實(shí)現(xiàn)代碼,有需要的朋友可以參考一下2013-10-10

