imballinst / react-bs-datatable

Bootstrap datatable without jQuery. Features include: filter, sort, pagination, checkbox, and control customization.
https://imballinst.github.io/react-bs-datatable
MIT License
59 stars 20 forks source link

Documentation: `data[rowIdx] is undefined` when creating custom rows #170

Closed Thomas-Boi closed 1 year ago

Thomas-Boi commented 1 year ago

Hello @imballinst ,

I found a problem that I missed during testing. When I render the rows using custom rows (see this sandbox, line 44 and 56, the checkbox will fail when I click them. After looking through the code, I found that adding rowIdx will fix the problem.

Suggested Solution This only happens during customization so it should be up to the user to address it. However, it'd be great if there's a Intellisense warning from Typescript that rowIdx is required. Updating the code docs might be necessary since this only break when checkbox is clicked and rowIdx is not provided. If I don't have checkboxes, the rows are rendered fine. I'll leave it up to you on how best to handle this.

Current jsdoc with no rowIdx Capture

imballinst commented 1 year ago

hi @Thomas-Boi, thanks for catching it and for the suggestion! Yeah, I agree that the documentation of TableRow could be improved so it's consistent with the TypeScript typings. I forgot to add that prop to the JSDoc documentation 🤦

I'll work on it sometimes tonight or tomorrow.

imballinst commented 1 year ago

This should be updated in the newest version 3.9.1. Details can be seen in this section: https://github.com/imballinst/react-bs-datatable/blob/v3.9.1/api/modules/components_TableBody.md#tablerow.

Let me know if you have more feedback. Thanks for report this issue!

Thomas-Boi commented 1 year ago

Sweet, thank you for working on this so quickly 👍