Bootstrap table check uncheck rows by array of values

html 复制代码
<link href="https://unpkg.com/bootstrap-table@1.22.1/dist/bootstrap-table.min.css" rel="stylesheet">

<script src="https://unpkg.com/bootstrap-table@1.22.1/dist/bootstrap-table.min.js"></script>

<div id="toolbar">
  <button id="button" class="btn btn-secondary">checkBy</button>
  <button id="button2" class="btn btn-secondary">uncheckBy</button>
</div>
<table
  id="table"
  data-toggle="table"
  data-toolbar="#toolbar"
  data-height="460"
  data-url="json/data1.json">
  <thead>
    <tr>
      <th data-field="state" data-checkbox="true"></th>
      <th data-field="id">ID</th>
      <th data-field="name">Item Name</th>
      <th data-field="price">Item Price</th>
    </tr>
  </thead>
</table>

<script>
  var $table = $('#table')
  var $button = $('#button')
  var $button2 = $('#button2')

  $(function() {
    $button.click(function () {
      $table.bootstrapTable('checkBy', {field: 'id', values: [1, 2, 3]})
    })
    $button2.click(function () {
      $table.bootstrapTable('uncheckBy', {field: 'id', values: [1, 2, 3]})
    })
  })
</script>
相关推荐
维克兜率天13 小时前
【维克】KDJ量化实战:如何用它判断买卖点?
前端
维克兜率天16 小时前
【维克】RSI相对强弱指数:判断多空力量的温度计
前端
FRing031 天前
vue2干货总结12(loading效果、全局前置导航守卫、搜索历史管理)
开发语言·前端·javascript·vue.js·vue2
YIAN1 天前
我踩完 DeepAgents 记忆模块的坑,才搞懂长期记忆和摘要不是一回事
前端·javascript·agent
map_3d_vis1 天前
百度地图 JSAPI 4.0 是什么:版本说明与能力概览
前端·javascript·webgl·地图·百度地图
码云之上1 天前
微信小程序设备指纹实践,删了重装还能认出这台手机吗?
前端·安全·微信小程序
JavaGuide1 天前
刚刚,GLM-5.4 正式发布,实测来了:看图用 Blender 建凉亭、做技术视频,再画一辆真能传动的自行车
前端·后端
乌鲁木齐德润恒圣信息科技有限公司1 天前
GEO生成式引擎优化:技术原理与43引擎自动测试系统
大数据·前端·人工智能
泯泷1 天前
第一章:Lit简介 - 现代Web组件标准
前端·javascript·web components
Moment1 天前
AI 写代码越来越快,程序员为什么反而更累了
前端·后端·面试