antd table 行选择 rowSelection 各种情况

1. 去掉全选框

官网文档上写的 hideDefaultSelections 这个属性设置为true可去掉全选,但是配置之后根本不行

给columnTitle 这个属性设置为空格即可,注意是空格‘ ’不是空字符串‘’

2. 单选还是复选

type 多选/单选,checkbox or radio

3. 可选,不可选

getCheckboxProps 选择框的默认属性配置 Function(record)

 :rowSelection="{
        selectedRowKeys: selectedRowKeys,
        onChange: onSelectChange,
        getCheckboxProps: getCheckboxProps,
        onSelect: onCheckChange,
        columnTitle: ' ',
      }"
 getCheckboxProps(record) {
      //  console.log(record.status, 'status');
      return {
        props: {
          //当状态是1或者2的时候执行disable
          disabled: record.subStatus != 0,
        },
      };
    },

猜你喜欢

转载自blog.csdn.net/zhuangjiajia09/article/details/125272948