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

row number error when using getRadioState after column sort #1771

Closed
nloneday opened this issue May 23, 2024 · 3 comments
Closed

row number error when using getRadioState after column sort #1771

nloneday opened this issue May 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@nloneday
Copy link

Version

1.0.0

Link to Minimal Reproduction

Steps to Reproduce

  1. load data ...
  2. sort by other column
  3. check the radio
const i = tableInstance.getRadioState('radioColumn')
const record = tableInstance.getRecordByCell(0, i + 1)

Current Behavior

The row number of tableInstance.getRadioState('radioColumn') is wrong, when sorting by other column.

Expected Behavior

Returning the new row number instead of original one

Environment

- OS: win10
- Browser: chrome
- Framework: vue3

Any additional comments?

No response

@nloneday nloneday added the bug Something isn't working label May 23, 2024
@Rui-Sun
Copy link
Contributor

Rui-Sun commented May 23, 2024

getRadioState function return a radio state array, which is in the order of data records order(not row order).
If you want to get the radio state of row order, you need to use getCellCheckboxState API in a loop.

@nloneday
Copy link
Author

getRadioState function return a radio state array, which is in the order of data records order(not row order). If you want to get the radio state of row order, you need to use getCellCheckboxState API in a loop.

It's still a little bit counterintuitive, checking the radio means user wants to select the row and does something else with this record, but can not getRecordByCell correctly. Thanks anyway for your advice.

@nloneday
Copy link
Author

const i = tableInstance.getRadioState('radioColumn') # original data index
# const record = tableInstance.getRecordByCell(0, i + 1)
const record = tableInstance.records[i] # original data records

got it!

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