Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using fieldgroup module to tidy up my input forms. It seems I can't place the map widget into a closed tab, since then the map only displays in a small fraction of the allocated area.
https://skitch.com/nikkenheimer/fjkfg/create-trip-horisontrejser
Placing it in open tabs works.
I'm using Chrome and FF on OSX. The theme is currently still core Bartik.
Comments
Comment #1
phayes CreditAttribution: phayes commentedThis is an issue with open-layers...
Regrettably I think this is *actually* an issue with the google-maps API that is used to draw the base-layer you are using.
I would suggesting googling for the openlayers JS library and see how it deals with google maps layers and see if other people have seen this issue
Comment #2
NicolasH CreditAttribution: NicolasH commentedYeah, ok....makes sense. Thanks for the clarification.
Comment #3
zzolo CreditAttribution: zzolo commentedHey @NicolasH, were you able to find a way around this. Its a tough one.
Comment #4
zzolo CreditAttribution: zzolo commentedRelated issue: #1025708: Open Layers and Quicktabs (with ajax): TypeError: this.center is null
This is mostly a limitation of the OL library not being able to initialize maps on page load. We can either workaround this in the module, or focus on fixing upstream. The latter is better but requires specific expertise and time.
Basic search suggests using
map.updateSize()
?Comment #5
nod_Actually i think it's an issue with verticaltabs. I have a custom form with a few fieldsets hidden in one of them is a OL map, no problem with it. Can someone post a way to replicate this ? (and it's working fine for the center map in admin form too)
Is this just with gmap ?
thansk.
Comment #6
castawaybcn CreditAttribution: castawaybcn commentedSubscribing.
I came here from #1168440: google maps layer not properly displayed - thanks zzolo- I have a similar issue but with 6.x and the map (google only) is displayed in a colorbox
Comment #7
NicolasH CreditAttribution: NicolasH commented@zzolo, no, having the map in an initially closed tab was a nice-to-have, not a requirement, so I just placed it somewhere else. Thanks for looking into it, though.
Comment #8
zzolo CreditAttribution: zzolo commentedSo, this should in theory be working fine. The OL UI module uses vertical tabs and has a map in one.
If this is still a problem, the only solution we can try to do is create a behavior for fieldsets that runs map.updateSize() when it it opens up, but otherwise, people will have to manage this themselves.
Comment #9
RuiMendes CreditAttribution: RuiMendes commentedI'm having the same problem with views accordion:
http://www.bichodepessego.com/fpsk_new/en/user/20
did anyone find a solution for this?
Thanks.
Comment #10
zzolo CreditAttribution: zzolo commentedThis should work if the element is rendered on load (not hidden with display none). And if that doesn't work, you'll have to use map.updateSize() in some way.
Comment #11
Countzero CreditAttribution: Countzero commentedJust for people who are struggling with this, here is some sample code I finally used to make it work.
This works for a map embeded in a JQuery Tab :
Hope it can help and thanks for the tips contained in this thread.
Comment #12
PolFor which version of Openlayers ?
Comment #13
Countzero CreditAttribution: Countzero commentedOL 2-dev, the one listed for this issue.
Comment #14
PolOk.
Comment #15
namwebs CreditAttribution: namwebs commented@Countzero #11 - I have the same requirement; can you please elaborate on where this code needs to go?
Comment #16
Countzero CreditAttribution: Countzero commentedSomewhere in a custom module's js file, as per https://www.drupal.org/node/756722.
Comment #17
namwebs CreditAttribution: namwebs commentedThanks, I will give it a go.
Update - great, I got it working.
:-)