Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 同时设置 checkbox 以及表列拖拽时,按住 checkbox 也能拖拽 #3456

Open
libondev opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@libondev
Copy link
Contributor

libondev commented Feb 20, 2025

Version

1.16.1

Link to Minimal Reproduction

https://www.visactor.io/vtable/demo/cell-type/checkbox

Steps to Reproduce

同时设置 options.select.disableSelect = true 以及 options.dragHeaderMode = 'column' 即可稳定复现该问题(不设置 options.select.disableSelect = true 也可以复现,只不过操作起来要求更高一些),完整复现代码如下:

const records = [
  { productName: 'aaaa', price: 20, check: { text: 'unchecked', checked: false, disable: false } },
  { productName: 'bbbb', price: 18, check: { text: 'checked', checked: true, disable: false } },
  { productName: 'cccc', price: 16, check: { text: 'disable', checked: true, disable: true } },
  { productName: 'cccc', price: 14, check: { text: 'disable', checked: false, disable: true } },
  { productName: 'eeee', price: 12, check: { text: 'checked', checked: false, disable: false } },
  { productName: 'ffff', price: 10, check: { text: 'checked', checked: false, disable: false } },
  { productName: 'gggg', price: 10, check: { text: 'checked', checked: false, disable: false } }
];

const columns = [
  {
    field: 'isCheck',
    title: '',
    width: 60,
    headerType: 'checkbox',
    cellType: 'checkbox'
  },
  {
    field: 'productName',
    title: 'productName',
    width: 120
  },
];
const option = {
  records,
  columns,
  select: {
    disableSelect: true,
  },
  dragHeaderMode: 'column',
};
const tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option);

tableInstance.on('checkbox_state_change', console.log)
window['tableInstance'] = tableInstance;

Current Behavior

如标题

Image

Expected Behavior

在按下 checkbox 的时候不触发拖拽行为,只有按下空白的区域时才触发(其他类型的表列也应该按照此类逻辑,例如 radio)

Environment

- OS: 任意
- Browser: 任意
- Framework: 任意

Any additional comments?

严格来讲,这其实不算bug,说是优化点可能更合适一点 :D

@libondev libondev added the bug Something isn't working label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants