Problem/Motivation

Drupal.tableDrag.prototype.initColumns hides the tabledrag ordering column, but skips checking elements that are already hidden. This means that the ordering column is not properly hidden in collapsed fieldsets, vertical tabs, or in elements initially hidden using #states.

Proposed resolution

#303189-52: Tabledrag doesn't hide columns when the whole table is initially hidden resolves the issue. It has been confirmed to work properly in major browsers, both when the table is initially hidden and when it is not.

  • Firefox: confirmed
  • Safari: confirmed
  • Chrome: confirmed
  • IE: confirmed

Remaining tasks

None.

User interface changes

None.

API changes

None.

Original report by @Darren Oh

Tested in Firefox 3. Elements in a collapsed fieldset inherit the display: none setting, and tabledrag.js skips elements with display set to none. Skipping does not seem to be necessary.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Title: Tabledrag doesn't hide columns when fieldset is collapsed » Tabledrag doesn't hide columns when fieldset is collapsed

Patch failed to apply. More information can be found at http://testing.drupal.org/node/14016. If you need help with creating patches please look at http://drupal.org/patch/create

Darren Oh’s picture

Title: Tabledrag doesn't hide columns when fieldset is collapsed » Tabledrag doesn't hide columns when fieldset is collapsed
FileSize
759 bytes

Bot needs to learn not to run check_plain() on issue titles.

bdragon’s picture

oh, so THAT's why I'm having problems trying to add tabledrag compatibility to location.

Subscribing.

bdragon’s picture

The header wasn't hiding either.

sradomski’s picture

I ran into this with a collapsed fieldset containing a draggable table. Manually applying the patch solves the problem for me at least in Safari4beta and Opera9.6.

droople’s picture

Any updates on this? WOuld really need this for Location module

Darren Oh’s picture

Status: Needs review » Reviewed & tested by the community

This is ready.

Gábor Hojtsy’s picture

Version: 6.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Needs review

New stuff and bugfixes go first to Drupal 7 to avoid regressions popping up. Needs review on D7.

Status: Needs review » Needs work

The last submitted patch failed testing.

Darren Oh’s picture

Status: Needs work » Needs review
FileSize
964 bytes

Patch for Drupal 7.

Status: Needs review » Needs work

The last submitted patch failed testing.

Darren Oh’s picture

Status: Needs work » Needs review
FileSize
1.37 KB

Status: Needs review » Needs work

The last submitted patch failed testing.

Darren Oh’s picture

Darren Oh’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

q0rban’s picture

q0rban’s picture

This definitely needs work, as there's lots of cruft in tabledrag from getting it to work in older browsers. Please see this comment.

q0rban’s picture

Status: Needs work » Needs review
FileSize
1.65 KB
udig’s picture

#425148: Form elements within a collapsed field group are not visible in Internet Explorer was marked as duplicate for this issue. Is it?
The symptoms mentioned here seems to be different then those mentioned there.

In addition can the above patch be applied for D6 as well or only D7?

thanks.

Darren Oh’s picture

Use the patch in #4 for Drupal 6.

q0rban’s picture

FileSize
1.65 KB

Keeping up to date with HEAD. Still needs review!

q0rban’s picture

Issue tags: +Usability

Tagging this with 'Usability'

Re-test of from comment #2242176 was requested by @user.

osopolar’s picture

FileSize
1.78 KB

This problem appeared together with cck multiple value fields, fieldgroup and vertical_tabs. To not patch the core itself I took the critical function (patched it) and put it in a separate js-file in my theme/js folder and I overwrote the function theme_content_multiple_values in the themes template.php like this:

function my_them_content_multiple_values($element) {
  $output = theme_content_multiple_values($element);
  
  drupal_add_js($GLOBALS['theme_path'].'/js/tabledrag-workaround.js', 'theme');

  return $output;
}

I attached the js-file (remove the txt-extension to use it).

casey’s picture

Status: Needs review » Needs work

TS:

Elements in a collapsed fieldset inherit the display: none setting, and tabledrag.js skips elements with display set to none. Skipping does not seem to be necessary.

This is no longer the case in D7 as collapse only hides the wrapper with class .fieldset-wrapper. Does this mean this issue is fixed for D7?

Darren Oh’s picture

Status: Needs work » Reviewed & tested by the community

display:none is added by jQuery when the fieldset is hidden. So this is still waiting to be fixed.

aspilicious’s picture

Status: Reviewed & tested by the community » Needs work

If it needs to be fixed why RTBC?

q0rban’s picture

Status: Needs work » Needs review

Should be needs review, as #22 still hasn't had anyone review it. :)

Darren Oh’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.63 KB

aspilicious: Drupal is waiting to be fixed. I reviewed #22, and it was ready to be committed. I'm attaching a simplified version with no major changes, so this is still reviewed and tested.

q0rban’s picture

Looks good to me. Needs testing across major browsers.

Status: Reviewed & tested by the community » Needs work
Issue tags: -Usability

The last submitted patch, tabledrag.js-303189-31.patch, failed testing.

aspilicious’s picture

Status: Needs work » Needs review
Issue tags: +Usability

#31: tabledrag.js-303189-31.patch queued for re-testing.

dboulet’s picture

The index variable needs to be reset every time that we loop, in case there was a colspan and the index got adjusted.

cburschka’s picture

In the meantime, there is now a working patch that leaves the Safari workaround in place:

#769520: tabledrag does not work on hidden tables

q0rban’s picture

Marked #769520: tabledrag does not work on hidden tables as a duplicate of this issue.

dboulet’s picture

Issue tags: -Usability

#35: drupal7-tabledrag.js_303189.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Usability

The last submitted patch, drupal7-tabledrag.js_303189.patch, failed testing.

dboulet’s picture

The tabledrag JavaScript code in Drupal 7 seems to have changed a lot since the last patch was submitted, is this still an issue in D7?

ZoeN’s picture

Bump. Definitely still an issue in Drupal 6.

yonailo’s picture

+1 subscribing, it needs to be fixed in D6 too.

Peter Törnstrand’s picture

New patch against HEAD, removed unused variable parentTag.

bdragon’s picture

Status: Needs work » Needs review
ogi’s picture

I hit this bug too. My drag table is in a vertical tab that is not the first one so it's not selected in the initial loading of the page.

vectoroc’s picture

Issue tags: +Needs backport to D6

subscribing

gunzip’s picture

subscribe

fietserwin’s picture

Version: 7.x-dev » 8.x-dev
FileSize
1019 bytes

Patch adapted a bit to clean up the var columnIndex. Patches correctly on both D7.2 and D8-dev. Works fine on D7.2 in firefox 4. Can anyone confirm and RTBC?

fietserwin’s picture

Issue tags: +Needs backport to D7

adding tag

Status: Needs review » Needs work

The last submitted patch, drupal7-tabledrag.js_303189-48.patch, failed testing.

fietserwin’s picture

Status: Needs work » Needs review
FileSize
1.08 KB
fietserwin’s picture

FileSize
2.14 KB

I did some further testing myself, and on tables with a colspan in the header it went wrong :(. Over optimised by removing the var index. So I reintroduced this var but did optimise the jquery object creation in the remainder (use a var cells instead of a var row) and that does work fine.

Can anyone confirm and RTBC?

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

This fix also applies to the same bug when a table is initially hidden with #states.
It solves both. And the resulting code is easier to understand!

anon’s picture

The patch in #53 works for Drupal 7 aswell.

longwave’s picture

Subscribing, ran into the same issue described in #45

xjm’s picture

Title: Tabledrag doesn't hide columns when fieldset is collapsed » Tabledrag doesn't hide columns when the whole table is initially hidden
xjm’s picture

Added an issue summary. It would probably be a good idea to state explicitly which browsers this has been tested in, and also confirm that the table behaves properly when the whole thing is not initially hidden.

xjm’s picture

Issue summary: View changes

Revamped issue summary.

xjm’s picture

Issue summary: View changes

Updated issue summary with vertical tabs example.

xjm’s picture

Issue summary: View changes

Added list of browsers for reference.

fietserwin’s picture

Issue summary: View changes

Removed a minor browser,and confirmed for browsers I tested.

tim.plunkett’s picture

Re-RTBC, the issue summary is updated.

tim.plunkett’s picture

Issue summary: View changes

Updated issue summary.

webchick’s picture

Version: 8.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: -Usability, -Needs backport to D7

Well this looks like a great code simplification, and a bug fix. Nice!

Committed and pushed to 8.x and 7.x. Marking back to 6.x.

vectoroc’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.91 KB

tested in FF 3.16 & Chrome 12.0.742

xjm’s picture

Looks good, same code. Maybe we want one more person to test the patch functionally on D6.

tmsimont’s picture

I just found this -- I had written a similar patch in a different, duplicate issue. I closed the other issue, http://drupal.org/node/842498#comment-5199120, for reference.

I have not tested vctoroc's patch -- it seems to make more dramatic alterations than I did, but the adjustment is very similar.

Something to note, this also affects JQuery Update module, since that module rewrites and replaces tabledrag. If this patch is accepted, would you re-file with JQuery update?

see: http://drupal.org/node/1298618

xjm’s picture

Note that you can type the issue number like so: #1298618: tabledrag.js does not work properly with CCK "collapsed" fieldset
To render a nice issue link like so: #1298618: tabledrag.js does not work properly with CCK "collapsed" fieldset

I'd just leave the jQ update issue you've already filed open. When this issue is fixed, that module can be updated as needed.

If you have the chance, could you test this patch and report the results? If you can confirm that it works, then we can mark this RTBC for D6.

tmsimont’s picture

cool i always wondered how people got those nicely formatted links...

I will test when i get a chance, unfortunately, however, i'm pretty buried at the moment and actually ditched the tabledrag field i was using so i won't be able to get into to it right away.

kentr’s picture

#60 worked for me in FF Mac 16.0.2.

kentr’s picture

Issue summary: View changes

All major browsers confirmed. I'm not going to quibble about Opera. ;)

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.