Skip to content

When using the rowSelection object to configure selection, using variables to configure selectedRowKeys results in the failure to appear in the selected state #6824

@ghost

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.0.0-rc.6

Environment

System version: Linux Mint;Browser version: Google Chrome 115.0.5790.170;Vue version: 3.3.4

Reproduction link

Edit on CodeSandbox

Steps to reproduce

{{ text }}

const selectedRowKeys = ref<string[]>([])
const rowSelection: TableProps['rowSelection'] = {
selectedRowKeys: selectedRowKeys.value,
onChange: (selectedRowKeys: string[], selectedRows: DataType[]) => {
console.log(selectedRowKeys: ${selectedRowKeys}, 'selectedRows: ', selectedRows);
selectedRowKeys.value = selectedRowKeys.map(String)
},
getCheckboxProps: (record: DataType) => ({
disabled: record.name === 'Disabled User', // Column configuration not to be checked
name: record.name,
}),
};

What is expected?

Click the checkBox in the first column of the table to become selected

What is actually happening?

After clicking the checkBox in the first column of the table, it will not become selected, but the value of selectedRowKeys.vlaue has been updated


Scenario: Basic use of tables

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions