Open PFischbeck opened 1 month ago
The commit where you added
import { makeFormSortable } ...
instead of the script tag has a message starting with "Fix" - I am curious, was the previous version not working anymore?
Correct! Once I added import { selectOrError } from "./utils.js";
, it failed. To be honest, I can't remember exactly why, but this has something to do with modules and scripts, where I can't do imports within scripts. Switching to using sortable-form
as a module import instead of a script fixed it.
Ah right, it has to itself be a module to import from other modules. Alright!
On http://localhost:8000/staff/faq/, I also get
Uncaught TypeError: row.querySelector(...) is null rowChanged http://localhost:8000/staff/faq/:815 applyOrdering http://localhost:8000/static/js/sortable-form.js:5 applyOrdering http://localhost:8000/static/js/sortable-form.js:4 makeFormSortable http://localhost:8000/static/js/sortable-form.js:72
failing at
const nameDe = row.querySelector('input[id$=-title_de]').value;
while row
is the header row (that doesn't contain any input fields).
That's weird, I can't reproduce this error locally, neither in Firefox nor Safari. I open http://localhost:8000/staff/faq/ and am able to drag and reorder the items.
That's weird, I can't reproduce this error locally, neither in Firefox nor Safari. I open http://localhost:8000/staff/faq/ and am able to drag and reorder the items.
Sorry, I should have added that: Drag+Drop works fine. The error happens when you click the submit button, after reloading the page the order is reset to the initial order.
That's weird, I can't reproduce this error locally, neither in Firefox nor Safari. I open http://localhost:8000/staff/faq/ and am able to drag and reorder the items.
Sorry, I should have added that: Drag+Drop works fine. The error happens when you click the submit button, after reloading the page the order is reset to the initial order.
Thanks for the clarification, makes sense! This should be fixed now.
This helps (maybe resolves?) #2082. In particular,
sortable-form.js
is now in TypeScript, and the scripts using it also don't use jQuery anymore. Note thatjquery.formset.js
still requires jQuery...Possible future things:
sortablejs
dependency (remember to update the JS types and remove the "ignore" for dependabot then)jquery.formset.js
by some TS version that does not depend on jQueryPlease test the changed forms to make sure nothing broke :)