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.
Comment | File | Size | Author |
---|---|---|---|
#60 | drupal6-tabledrag.js-303189.patch | 1.91 KB | vectoroc |
#52 | 303189-52.patch | 2.14 KB | fietserwin |
#51 | 303189-51.patch | 1.08 KB | fietserwin |
#43 | drupal7-tabledrag.js_303189-2.patch | 1.2 KB | Peter Törnstrand |
#35 | drupal7-tabledrag.js_303189.patch | 1.6 KB | dboulet |
Comments
Comment #2
Darren OhBot needs to learn not to run check_plain() on issue titles.
Comment #3
bdragon CreditAttribution: bdragon commentedoh, so THAT's why I'm having problems trying to add tabledrag compatibility to location.
Subscribing.
Comment #4
bdragon CreditAttribution: bdragon commentedThe header wasn't hiding either.
Comment #5
sradomski CreditAttribution: sradomski commentedI 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.
Comment #6
droople CreditAttribution: droople commentedAny updates on this? WOuld really need this for Location module
Comment #7
Darren OhThis is ready.
Comment #8
Gábor HojtsyNew stuff and bugfixes go first to Drupal 7 to avoid regressions popping up. Needs review on D7.
Comment #10
Darren OhPatch for Drupal 7.
Comment #12
Darren OhComment #14
Darren OhComment #15
Darren OhComment #17
q0rban CreditAttribution: q0rban commentedMarked #339105: Tabledrag not hiding columns inside collapsed fieldsets as a duplicate of this issue.
Comment #18
q0rban CreditAttribution: q0rban commentedThis definitely needs work, as there's lots of cruft in tabledrag from getting it to work in older browsers. Please see this comment.
Comment #19
q0rban CreditAttribution: q0rban commentedComment #20
udig CreditAttribution: udig commented#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.
Comment #21
Darren OhUse the patch in #4 for Drupal 6.
Comment #22
q0rban CreditAttribution: q0rban commentedKeeping up to date with HEAD. Still needs review!
Comment #23
q0rban CreditAttribution: q0rban commentedTagging this with 'Usability'
Comment #26
osopolarThis 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:
I attached the js-file (remove the txt-extension to use it).
Comment #27
casey CreditAttribution: casey commentedTS:
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?
Comment #28
Darren Ohdisplay:none is added by jQuery when the fieldset is hidden. So this is still waiting to be fixed.
Comment #29
aspilicious CreditAttribution: aspilicious commentedIf it needs to be fixed why RTBC?
Comment #30
q0rban CreditAttribution: q0rban commentedShould be needs review, as #22 still hasn't had anyone review it. :)
Comment #31
Darren Ohaspilicious: 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.
Comment #32
q0rban CreditAttribution: q0rban commentedLooks good to me. Needs testing across major browsers.
Comment #34
aspilicious CreditAttribution: aspilicious commented#31: tabledrag.js-303189-31.patch queued for re-testing.
Comment #35
dboulet CreditAttribution: dboulet commentedThe index variable needs to be reset every time that we loop, in case there was a colspan and the index got adjusted.
Comment #36
cburschkaIn the meantime, there is now a working patch that leaves the Safari workaround in place:
#769520: tabledrag does not work on hidden tables
Comment #37
q0rban CreditAttribution: q0rban commentedMarked #769520: tabledrag does not work on hidden tables as a duplicate of this issue.
Comment #38
dboulet CreditAttribution: dboulet commented#35: drupal7-tabledrag.js_303189.patch queued for re-testing.
Comment #40
dboulet CreditAttribution: dboulet commentedThe 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?
Comment #41
ZoeN CreditAttribution: ZoeN commentedBump. Definitely still an issue in Drupal 6.
Comment #42
yonailo CreditAttribution: yonailo commented+1 subscribing, it needs to be fixed in D6 too.
Comment #43
Peter Törnstrand CreditAttribution: Peter Törnstrand commentedNew patch against HEAD, removed unused variable
parentTag
.Comment #44
bdragon CreditAttribution: bdragon commentedComment #45
ogi CreditAttribution: ogi commentedI 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.
Comment #46
vectoroc CreditAttribution: vectoroc commentedsubscribing
Comment #47
gunzip CreditAttribution: gunzip commentedsubscribe
Comment #48
fietserwinPatch 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?
Comment #49
fietserwinadding tag
Comment #51
fietserwinComment #52
fietserwinI 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?
Comment #53
tim.plunkettThis 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!
Comment #54
anonThe patch in #53 works for Drupal 7 aswell.
Comment #55
longwaveSubscribing, ran into the same issue described in #45
Comment #56
xjmComment #57
xjmAdded 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.
Comment #57.0
xjmRevamped issue summary.
Comment #57.1
xjmUpdated issue summary with vertical tabs example.
Comment #57.2
xjmAdded list of browsers for reference.
Comment #57.3
fietserwinRemoved a minor browser,and confirmed for browsers I tested.
Comment #58
tim.plunkettRe-RTBC, the issue summary is updated.
Comment #58.0
tim.plunkettUpdated issue summary.
Comment #59
webchickWell 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.
Comment #60
vectoroc CreditAttribution: vectoroc commentedtested in FF 3.16 & Chrome 12.0.742
Comment #61
xjmLooks good, same code. Maybe we want one more person to test the patch functionally on D6.
Comment #62
tmsimont CreditAttribution: tmsimont commentedI 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
Comment #63
xjmNote 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.
Comment #64
tmsimont CreditAttribution: tmsimont commentedcool 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.
Comment #65
kentr CreditAttribution: kentr commented#60 worked for me in FF Mac 16.0.2.
Comment #65.0
kentr CreditAttribution: kentr commentedAll major browsers confirmed. I'm not going to quibble about Opera. ;)