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>
相关推荐
宇擎智脑科技22 分钟前
Claude Code 源码分析(七):终端 UI 工程 —— 用 React Ink 构建工业级命令行界面
前端·人工智能·react.js·ui·claude code
dragon72533 分钟前
Flutter错误处理机制
前端·flutter
数据知道35 分钟前
claw-code 源码详细分析:Bootstrap Graph——启动阶段图式化之后,排障与扩展为什么会变简单?
前端·算法·ai·bootstrap·claude code·claw code
悟空瞎说44 分钟前
深度解析:Vue3 为何弃用 defineProperty,Proxy 到底强在哪里?
前端·javascript
leafyyuki1 小时前
告别 Vuex 的繁琐!Pinia 如何以更优雅的方式重塑 Vue 状态管理
前端·javascript·vue.js
Amos_Web1 小时前
Solana开发(1)- 核心概念扫盲篇&&扫雷篇
前端·rust·区块链
Hooray1 小时前
AI 时代的管理后台框架,应该是什么样子?
前端·vue.js·ai编程
ZC跨境爬虫1 小时前
极验滑动验证码自动化实战(ddddocr免费方案):本地缺口识别与Playwright滑动模拟
前端·爬虫·python·自动化
某人辛木1 小时前
nodejs下载安装
开发语言·前端·javascript
Ztopcloud极拓云视角1 小时前
Claude Code 源码泄露事件技术复盘:npm sourcemap 配置失误的完整分析
前端·npm·node.js