When editing a preset, when you are on the layers & styles tab, the overlay layers table has a weight field which contains a checkbox element (screenshot attached).

This doesn't seem to make much sense and if you don't check the box in the weight column your layer will not show up on openlayers views.

CommentFileSizeAuthor
openlayers-presets_overlays_weight.png112.66 KBAgileware
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

strk’s picture

I've seen this too, but can't reproduce on my own host. Must be dependent on the CSS.
Theoretically the 'weight' table header should _not_ be visible, and this is what happens for me.

If you want to help debugging, check out:
modules/openlayers_ui/includes/openlayers_ui.theme.inc

Search for drupal_add_tabledrag() call (around line 109)
That call can take 3 additional args: NULL, NULL, false
The last arg (false) instructs to hide or not the 'weight' widget.
When set to false you should see that the widget for 'weight' is a select, not a checkbox,
while the checkbox belongs to next column...

On my system, setting to true (the default) hides _both_ the widget _and_ the header.

Agileware’s picture

Title: Preset layers & styles overlay layers weight is a checkbox » Preset layers & styles overlay layers weight header is not hidden on draggable table

Changing the title as it is not a checkbox for the weight field but the enabled field.
The problem is just that the header of the weight field is not being hidden by tabledrag.js.

If I force display of the weight column as you suggested I get the select field and everything lines up correctly under their own headings.

After a quick investigation it looks the problem is jquery_update 2 (6.x-2.0-alpha1 or 6.x-2.x-dev).
The problem is occurring In that module's version of tabledrag.js at around line 115 where it does:

// Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
var columnIndex = $('td', cell.parent()).index(cell.get(0)) + 1;
var headerIndex = $('td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1; 

Here $('td:not(:hidden)', cell.parent()).index(cell.get(0)) is returning -1 because cell.get(0) is not found.
So columnIndex is 2 and headerIndex is 0.

That's as far as I got for now but if I downgrade to jquery_update 1.x it works as expected.

Using other draggable tables with jquery_update 2.x this problem doesn't seem to happen (menus & blocks pages). It seems to be only with this one table.

strk’s picture

The specificity of this one is that the 'weight' field is not the first one.
I moved somewhere somewhere inside as I was having problems with it on the first column as well.
Anyway, if it's a bug with jquery I guess we can close this ?

Agileware’s picture

Status: Active » Fixed

Yeah, I came across this issue that refers to the first column problem - #368973: tabledrag.js: Drag handle is added to the weight-td if it's the first td and gets hidden

Yeah I guess it can be considered a jquery_update issue as it doesn't happen with other versions of jquery.
The fact I can't find another table that has the problem is annoying but I have not exactly been exhaustive in my search.

Status: Fixed » Closed (fixed)

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