TableDnD icon indicating copy to clipboard operation
TableDnD copied to clipboard

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

Open WeiweiQi opened this issue 5 years ago • 6 comments

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.

WeiweiQi avatar Nov 13 '19 08:11 WeiweiQi

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?

isocra avatar Nov 13 '19 15:11 isocra

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.

WeiweiQi avatar Nov 15 '19 00:11 WeiweiQi

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!

vincentwansink avatar May 07 '21 22:05 vincentwansink

@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 :)

brendon avatar May 08 '21 02:05 brendon

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.

vincentwansink avatar May 10 '21 15:05 vincentwansink

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.

brendon avatar May 10 '21 20:05 brendon