If the filefield is placed within a standard collapsible group, then the order dropdowns are not hidden.

Is there a way to hide the weight order?

Images attached.

Comments

harcher’s picture

Title: Order weight is no hidden if field is set inside a Group » Order weight is not hidden if field is set inside a Group
quicksketch’s picture

Project: FileField » Content Construction Kit (CCK)
Version: 6.x-3.7 » 6.x-2.7
Component: Code » fieldgroup.module

Sounds like a CCK issue. FileField is not responsible for managing multiple values or the drag and drop ordering of multiple values.

tmsimont’s picture

Title: Order weight is not hidden if field is set inside a Group » Field's order dropdown column, .delta-order, not hidden by tabledrag javascript if field is inside "collapsed" fieldgroup
Version: 6.x-2.7 » 6.x-2.9

This issue persists in the most recent CCK release. I'm updating the title, and merging a duplicate (if I can... http://drupal.org/node/660864) .

The type of field is irrelevant to the problem. In this particular issue, hga77 had a problem with filefield. It happens with text fields, too.

To reproduce:
1) create a field group
2) set field group to "collapsed"
3) create a field with unlimited number

The biggest issue is that td.delta-order does not get hidden by the tabledrag javascript. There's another related issue (http://drupal.org/node/808078?mode=2&sort=2) of a bunch of extra scrollbars, too.

It seems that at some point there was also another issue in IE (http://drupal.org/node/425148) -- I'm not experiencing that, but figured it would be worth noting as it seems that the "collapsed" fieldgroup (not "collapsible") is pretty buggy all around...

tmsimont’s picture

Project: Drupal core » Content Construction Kit (CCK)
Version: 6.22 » 6.x-2.9
Component: javascript » fieldgroup.module
Status: Needs review » Active

I think I found the problem in tabledrag.js:

ln 113: if (hidden && cell[0] && cell.css('display') != 'none') {
...

because the cell is hidden on load by the collapsed class, then cell.css('display' != 'none) returns false, causing the hideColumns() script to abort before the column is hidden.

Removing that code hides the column, but not the table head.. more in a bit...

tmsimont’s picture

head stays because of this:

      var headerIndex = $('td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1;

the head is hidden if collapsed... returning nothing

tmsimont’s picture

Project: Content Construction Kit (CCK) » Drupal core
Version: 6.x-2.9 » 6.9
Component: fieldgroup.module » javascript
Status: Active » Needs review

I fixed the problem by replacing a function in tabledrag.js

Previously, that file was ignoring the .delta-order column if it was hidden on load. This caused a problem with "collapsed" fieldsets, because their delta dropdown is hidden on load!

I added a check for "hideColumns-processed" in place of the psuedo-selector :hidden and cell.css('display') != 'none'

I've changed this to core because tabledrag.js is not CCK.

This actually also affects JQuery update, as that file is replaced. If you have that module enabled, you'll have to update the tabledrag.js that comes packaged with it.

tmsimont’s picture

Version: 6.9 » 6.22
StatusFileSize
new1.38 KB

patch attach, also -- i had previously set the wrong Drupal version.

NOTE: this is for the core. if you're running JQuery Update, see http://drupal.org/node/1298618

tmsimont’s picture

Project: Content Construction Kit (CCK) » Drupal core
Version: 6.x-2.9 » 6.22
Component: fieldgroup.module » javascript
Status: Active » Needs review

hmm not sure why that got rejected -- could be the way i made the patch, but i think this really needs review as I found 3 total posts related to this issue. it's an out of the box bug and seems easy to fix... y u no likey my patch?

Everett Zufelt’s picture

Version: 6.22 » 6.x-dev

Is this happening in 8.x or 7.x? Patches should be rolled against the latest version and then backported where appropriate.

tmsimont’s picture

Pretty sure it's not an issue in 7.x, this is hideColumns() in 7:



/**
 * Hide the columns containing weight/parent form elements.
 * Undo showColumns().
 */
Drupal.tableDrag.prototype.hideColumns = function () {
  // Hide weight/parent cells and headers.
  $('.tabledrag-hide', 'table.tabledrag-processed').css('display', 'none');
  // Show TableDrag handles.
  $('.tabledrag-handle', 'table.tabledrag-processed').css('display', '');
  // Reduce the colspan of any effected multi-span columns.
  $('.tabledrag-has-colspan', 'table.tabledrag-processed').each(function () {
    this.colSpan = this.colSpan - 1;
  });
  // Change link text.
  $('.tabledrag-toggle-weight').text(Drupal.t('Show row weights'));
  // Change cookie.
  $.cookie('Drupal.tableDrag.showWeight', 0, {
    path: Drupal.settings.basePath,
    // The cookie expires in one year.
    expires: 365
  });
};

pretty different.. looks like it uses a class to ID what needs to be hidden as my patch for 6.x does.

I can't test in 7.x -- I just tried in 7.7 and can't even add a field to a custom content type? also, there doesn't seem to be a way to even add a fieldset in 7 core...
http://drupal.org/node/1022036

Status: Needs review » Needs work

The last submitted patch, tabledrag_collapsible_fields.patch, failed testing.

tmsimont’s picture

Status: Needs work » Closed (duplicate)