vxe-table点击分页依旧保存复选框选项以及复选框按条件禁用事件

  • :row-config=“{ isHover: true ,keyField:‘id’}”, keyField:‘id’–>自定义行数据唯一主键的字段名(默认自动生成)

    复选框点击事件,根据条件禁用复选框 :checkbox-config=“checkBoxConfig”

 <vxe-table
          border
          align="center"
          size="mini"
          show-header-overflow
          show-overflow
          :row-config="{ isHover: true ,keyField:'id'}"
          class="mytable-scrollbar"
          max-height="450"
          :checkbox-config="checkBoxConfig"
        >
        </vxe-table>
//点击事件,获取到所有所选数据
const xTable=ref(null)
const saveClick=()=>{
  const $table = xTable.value
   // getCheckboxRecords 获取当前页选中的数据
  // getCheckboxReserveRecords 获取已保留选中的行数据
  //通过_.concat lodash合并两个数组
  const selectRecords 
  =_.concat($table.getCheckboxRecords(),$table.getCheckboxReserveRecords())
}
// 表格checkbox根据条件禁用
const checkBoxConfig = {
  checkMethod: ({ row }) => {
    return !row.disable
  },
  //开启保留翻页选中
  reserve:true
}
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值