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

OnDrop not called When some problems of id of <tr>. #100

Open
WeiweiQi opened this issue Nov 13, 2019 · 6 comments
Open

OnDrop not called When some problems of id of <tr>. #100

WeiweiQi opened this issue Nov 13, 2019 · 6 comments

Comments

@WeiweiQi
Copy link

WeiweiQi commented Nov 13, 2019

Such as the same id of <tr>,

<tr id="1">first row<tr>
<tr id="1">scond row<tr>

or no id of <tr>.

<tr>first row<tr>
<tr>second row<tr>

And there is no error info or instructions about these errors.

@isocra
Copy link
Owner

isocra commented Nov 13, 2019

Hi @WeiweiQi

If you have duplicate ids, then getElementById won't work and your HTML is invalid. Can you add unique ids to your rows? Does it work if you do?

@WeiweiQi
Copy link
Author

Hi @WeiweiQi

If you have duplicate ids, then getElementById won't work and your HTML is invalid. Can you add unique ids to your rows? Does it work if you do?

Yes, the first time when tableDnd not work is because of no id of row. Just advise when something wrong, maybe some logs in the console is better. Not know much about javascript, but row can be moved when no id or duplicate ids, so logically, the error can be detected when it happens.

@vincentwansink
Copy link

I agree with Wei. There should be some indication, either in the console or the documentation that a unique ID on reach row is required. I just spent 30 minutes trying to figure out why the onDrop wasn't being called.

Not complaining, cause I appreciate the plugin, but just giving some feedback. Thanks!

@brendon
Copy link
Collaborator

brendon commented May 8, 2021

@vincentwansink, if you want to take a stab at writing some extra documentation and/or implementing this error message in the console I'd be happy to merge it in for you :)

@vincentwansink
Copy link

Actually I think on your Github page, in the Getting Started section, right before the HTML sample code and right after the words "but it works fine with these too):" I would just add "Important: Every row in the HTML table must have a unique ID."

I think that should be clear enough.

@brendon
Copy link
Collaborator

brendon commented May 10, 2021

Hi @vincentwansink, that'll be easy for you to do. You can edit that file on GitHub now and make your changes then submit them to us as a Pull Request. We'll merge that in for you.

gbastien added a commit to gbastien/TableDnD that referenced this issue Jul 4, 2022
I was hit by this again, this is also related to isocra#100

This you a new md markup available on github ;-)

Thank you for review and merge!

Gauthier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants