datasette / datasette-checkbox

Add interactive checkboxes to columns in Datasette
Apache License 2.0
6 stars 0 forks source link

Incompatible with datasette-write-ui and datasette-comments #2

Closed simonw closed 3 months ago

simonw commented 3 months ago

CleanShot 2024-08-16 at 13 48 12@2x

Because of this code: https://github.com/datasette/datasette-checkbox/blob/c028ac7197c77393166e4bec9fb6e74cb808ede9/datasette_checkbox/__init__.py#L42-L43

Those plugins add extra stuff to that <td> which interferes there.

simonw commented 3 months ago

Ideally Datasette would make the primary key available in a data- attribute, maybe on the <tr> for the row.

Temporary fix is to strip anything in a <span> before trying to read the primary key.

simonw commented 3 months ago
let copy = td.cloneNode(true)
Array.from(copy.querySelectorAll('span')).forEach(span => span.parentNode.removeChild(span));
let pk = copy.textContent;