Bootstrap Table使用整理(四)之工具列,bootstraptable

來源:互聯網
上載者:User

Bootstrap Table使用整理(四)之工具列,bootstraptable

相關閱讀:

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

Bootstrap Table使用整理(二)  http://www.bkjia.com/article/115791.htm

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

Bootstrap Table使用整理(五)之分頁組合查詢 http://www.bkjia.com/article/115785.htm

一、啟用預設支援的工具列

/* * data-search 是否顯示搜尋方塊 * data-show-refresh 是否像是重新整理按鈕,註:重新整理操作會重新請求資料,並帶著請求參數 * data-show-toggle 是否顯示面板切換按鈕 * data-show-columns 是否顯示列控制按鈕 */ $('#table1').bootstrapTable({  columns: [  { field: 'sno', title: '學生編號' },  { field: 'sname', title: '學生姓名' },  { field: 'ssex', title: '性別' },  { field: 'sbirthday', title: '生日' },  { field: 'class', title: '課程編號' },  ],  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> 

二、擴充工具列使用

/* * data-toolbar 用於指定id的div擴充工具列,這種方式類似EaseUI中的datagird * queryParams 請求伺服器資料時,你可以通過重寫參數的方式添加一些額外的參數,例如 toolbar 中的參數 如果 queryParamsType = 'limit' ,返回參數必須包含   limit, offset, search, sort, order 否則, 需要包含:   pageSize, pageNumber, searchText, sortName, sortOrder.   返回false將會終止請求 */ var $table1= $('#table1').bootstrapTable({  columns: [  { field: 'sno', title: '學生編號' },  { field: 'sname', title: '學生姓名' },  { field: 'ssex', title: '性別' },  { field: 'sbirthday', title: '生日' },  { field: 'class', title: '課程編號' },  ],  url: '@Url.Action("GetStudent","DataOne")',  queryParams: function (params) {  params.name = '張三丰';  //特別說明,返回的參數的值為空白,則當前參數不會發送到伺服器端  params.sex = $('input[name="sex"]:checked').val();  return params;  } }); //重新整理方法 $('#heartBtn').click(function () {  ////重新整理處理,指定query 的參數,註:此地方指定的參數,僅在當次重新整理時使用  //$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使用整理(四)之工具列,希望對大家有所協助,如果大家有任何疑問請給我留言,小編會及時回複大家的。在此也非常感謝大家對幫客之家網站的支援!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.