This is a follow up issue to #1450614: Port the Nodequeue widget to Entity reference

When adding multiple items before hitting "Save" or reordering multiple items, you will get several warning messages:

Changes made in this table will not be saved until the form is submitted.

and

Changes will not be saved until the form is submitted.

Comments

jojonaloha’s picture

Status: Active » Needs review

Attached patch to uses the Drupal.theme('tableDragChangedWarning') for the warning message. It also tries to mark the table as changed when adding an item in Drupal.tableDrag so that:

  • adding an item
  • rearranging items
  • adding another item

only shows one warning message. The one weird thing still is that when you click one of the "Shuffle", "Reverse" or "Clear" buttons, the message shows the first time, but because we are replacing the whole form it disappears the second time and the table is already marked as changed, so adding or rearranging items doesn't display the message anymore either.

I also think this patch conflicts with the one in #2157159: Dragtable widget does not work with multiple instances of a form on the same page. I might combine the issues since they touch a lot of the same code. It might also be nice to use the same ajax callback for both the field widget and the "Shuffle", "Reverse" and "Clear" buttons, since after this patch they are starting to look very similar.

jojonaloha’s picture

It'd help if I actually attached the patch ;)

arcane’s picture

Didn't completely work for me. Applied the patch, but I still get an extra line that displays "Show row weights" for each addition that pushes the table down. It does limit the warning to only display one time.

dmitriy.pokhodenko’s picture

StatusFileSize
new5.48 KB

Here is the patch based on #2 answer. Should solve problem with duplicate warnings and also solves problem with tabledrag switcher.

joelpittet’s picture

Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community

Awesome, I this a try and did fix this issue for me.

Thanks @dmitriy.pokhodenko and @jojonaloha

jojonaloha’s picture

Assigned: jojonaloha » Unassigned
Status: Reviewed & tested by the community » Fixed
StatusFileSize
new967 bytes

Nice work @dmitriy.pokhodenko!

Committed 7c84cc7

There was a whitespace issue, which I corrected, and an added line that wasn't needed. Attached is an interdiff between what was committed and the patch in #4.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.