Hello,

I installed recently all new DEV versions. I don't know exactly which one causes the problem but it's after end of January 2015.
Now if I go in Structure / Content Types / XXX / Manage Display, I can't drag fields anymore and Weight column appears.
URL : /admin/structure/types/manage/xxx/display

And I have this JS error :

TypeError: tableDrag is undefined
tableDrag.onDrop = this.onDrop;

in Core JS file : /modules/field_ui/fields_ui.js line 120

  attach: function (table, rowsData, rowHandlers) {
    var tableDrag = Drupal.tableDrag[table.id];

    // Add custom tabledrag callbacks.
    tableDrag.onDrop = this.onDrop;
    tableDrag.row.prototype.onSwap = this.onSwap;

If I go to admin/config/development/performance/advagg
And just disable AdvAgg by unchecking Enable advanced aggregation : it works again

I checked, others dragging functions like in Blocks page for example, or Rearrange fields in Views : they are working.
I just see this problem in Manage Display.

Best regards

CommentFileSizeAuthor
#5 dragging_fields_in-2426731-5.patch752 bytesjoelpittet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Frank.dev’s picture

same

SocialNicheGuru’s picture

I am getting the same thing too.

I also tried it with 'created .gz' enabled and disabled with the same error.

Disabling advagg gets rid of the error

joelpittet’s picture

Same here, it seems that the JS weights aren't being adhered to. When I stepped through the weights looked correct but tabledrag.js was loading after field_ui.js


modules/field_ui/field_ui.js => [weight => 0.037]
misc/tabledrag.js => [weight => -0.959]

joelpittet’s picture

Ok seems to be a PHP problem with the way this was implemented inside advagg_drupal_sort_css_js_stable():

https://bugs.php.net/bug.php?id=32671
http://stackoverflow.com/questions/4542234/working-with-an-array-with-pe...

Try this to see:
php -r '$value = -0.959; $array[$value] = TRUE; var_dump($array);'

joelpittet’s picture

Status: Active » Needs review
FileSize
752 bytes

Here's a patch.

srobert72’s picture

It works for me
@joelpittet : Thank you very much !!

I searched in commits history, but didn't find if it's a recent commit that caused this issue

joelpittet’s picture

@srobert72 you are very welcome, want to RTBC this so we can get this fixed up?

Thank you for reporting, I thought it was some other module messing with the weights before I started stepping through the code and happened upon that.

  • mikeytown2 committed f630a75 on 7.x-2.x authored by joelpittet
    Issue #2426731 by joelpittet: Dragging fields in Manage Display doesn't...
mikeytown2’s picture

Patch looks good! It's been committed. Will update this issue so we can get this fixed in D8
#1388546: Adding CSS or JS files twice changes weight

mikeytown2’s picture

Status: Needs review » Fixed
joelpittet’s picture

@mikeytown2 thank you for the super quick fix.

Status: Fixed » Closed (fixed)

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

sijuwi’s picture

Component: CSS/JS » Code

Not sure if this is related but if I check 'All but extrenal scripts' under 'Deferred JavaScript Execution: Add The defer Tag To All Script Tags' then I lose all my dragable weights under Content types >> 'Manage fields'

Version: Version: 7.x-2.21

mikeytown2’s picture

@sijuwi
Create a new issue, this one is over a year old. Also try a newer version of AdvAgg.