Open
Description
https://github.com/jrief/django-admin-sortable2/blob/2.1.10/client/admin-sortable2.ts#L214
This line selects the <thead>
of the field's widget <table>
and attaches the event listeners to it in if (tBody) {...}
This causes the UI to not handle the drag events correctly:
As a workaround, I've copy-pasted the compiled version of adminsortable2.js
to myproject/static/adminsortable2/js/adminsortable2.js
and modified the InlineSortable
's constructor as follows:
...
var InlineSortable = class {
constructor(inlineFieldSet) {
this.reversed = inlineFieldSet.classList.contains("reversed");
// Old code - selects any child (even tables inside fields' widgets)
// const tBody = inlineFieldSet.querySelector("table tbody");
// Fixed code - selects only direct child table
let tBody = null;
const table = inlineFieldSet.querySelector("table");
if (table && table.parentElement === inlineFieldSet) {
tBody = table.querySelector("tbody");
}
if (tBody) {
...
I am using:
Django==4.2.9
django-admin-sortable2==2.1.10
django-json-widget==1.1.1
Metadata
Metadata
Assignees
Labels
No labels