Closed (fixed)
Project:
Get Locations
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Jan 2012 at 15:49 UTC
Updated:
27 Oct 2012 at 20:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
dgastudio commentedthe above error appear in firebug /firefox
in chrome console appear:
%7Bmain,places%7D.js:32Uncaught TypeError: Cannot read property 'offsetWidth' of null
Comment #2
hutch commentedtry switching off markermanager
Comment #3
dgastudio commentedyep, now it's working. thanks
Comment #4
imclean commentedI'm not sure it really "Works as designed" if a feature needs to be turned off. Either way, my solution was a little different.
I was seeing the "a is null" error in Firefox but the map was displaying as expected in the generated block. The error was interfering with jcarousel and causing it to not function at all.
new google.mapsshould be fired on$(document).ready()so I've wrapped the call toinitialize().Comment #5
hutch commentedYes, "Works as designed" is not the best way to describe a feature that does not behave ;-)
The Markermanager software is third-party though and has been troublesome in other, non-drupal scenarios. It also is not fully usable as each marker should have a zoom level associated with it.
I have been playing with MarkerClustererPlus which looks much more promising, it is in the latest dev.
My understanding is that the
$(document).ready() ..... );construct has been replaced with(function ($) { ..... })(jQuery);which is present, the whole of getlocations.js is wrapped in it.I will try to reproduce the error with jcarousel and see what happens.
Comment #6
imclean commentedAh yes, that's what the attach bit is for. It does seem odd that it fires off an error but the map still works.
Chrome:
- jcarousel fields view in the first sidebar
- Location field stores lat/long
- "View: Getlocations map of a location" block displays map in content area
Problem:
- jcarousel View is an unstyled list of fields with no js.
The patch in #4 makes sure the DOM is full loaded first, but I guess this could be hiding another problem.
Comment #7
imclean commentedIt's also seems to kill other js on the page: admin_menu and megamenu in my case.
Comment #8
imclean commentedI can't get this to work with any other js in the latest dev.
As a test, I added an alert:
When then alert pops up no other js has been loaded, after clicking "ok" nothing works apart from getlocations.
With $(document).ready:
js has been loaded by the time the alert pops up (jcarousel lists are styled). After clicking OK, everything works as expected despite the "a is null" error still appearing. This includes jcarousel, admin_menu and megamenu.
The attach doesn't seem to be waiting for other js to be loaded.
Comment #9
hutch commentedThe "a is null" error comes from Google maps (I think). Switching off Markermanager would eliminate it for now. By the way I have now got support for Marker Clusterer which seems a lot better.
I'm looking at the details of how drupal adds js at the drupal_add_js API page.
getlocations.js is loaded in function getlocations_setup_js() in getlocations.module starting on line 696
It might be possible to give it "weight" or load it in footer
Why 'attach' is jumping the gun I don't know, perhaps it isn't but needs to be loaded later or deferred
hmmm I changed
to
Now it loads last.
Could you try that (line 768)?
Comment #10
imclean commentedThanks for the help. I've tried adding getlocations.js with the scope of footer which puts it down the bottom to no avail. I'll try the weight option as well.
Markermanager is not enabled. The map still works, it just kills everything else. Even with my addition the error occurs but it allows the other js to function.
It's very strange, I'm not sure attach is a good replacement for $(document).ready() in all cases.
Comment #11
hutch commentedI installed admin_menu and jcarousel (and getlocations using getlocations_fields) and have all 3 working fine on the same page.
I am using jQuery Update...
Comment #12
imclean commentedI'm using location module but that shouldn't make any difference. I do still wonder whether the problem is elsewhere.
jQuery 1.5.2 is the version I'm on. Will keep digging.
Comment #13
imclean commentedExcellent, thanks hutch! The following does indeed work with our custom theme.
This wasn't required when I tested with Garland. I had tried disabling all js and various stylesheest in our theme to no avail.
Comment #14
hutch commentedGood! I will add this as a configurable option to the next push, probably later today.
Comment #15
dgastudio commentedargh.....
latest dev version for now.
enabled default view: Getlocations map
a is null
...this.d,b)};function Vg(a,b,c){if(a=a[Za](b))c=o.pow(2,c),a.x*=c,a.y*=c;return a}...
in
{main,places}.js line 32
i have disabled marker manager, cluster.
also, in views
NetworkError: 404 Not Found - http://medstream.krypton.vps-private.net/sites/all/modules/getlocations/...
Comment #16
hutch commentedThe 404 Not Found has been fixed a just a few hours ago. I haven't been able to replicate the 'a is null' error.
You could try setting Getlocations Javascript weight in admin/config to 100, some themes seem to have a problem.
Comment #17
dgastudio commentedok, i'll wait a new release.
changing weight in admin config to 100, causes
a is undefined
...this.d,a)};var Pe="click",Qe="contextmenu",Re="forceredraw",Se="staticmaploaded"...
{main,places}.js (line 21)
a is null
(181 out of range 48)
{main,places}.js (line 181
can u take a look, please?
http://medstream.krypton.vps-private.net/catalog/institutions/medicinsko...
the map must appear in middle column
(i have removed weight for now.)
Comment #18
dgastudio commentedi'm testing in firefox, doesnt work.
in chrome, the error is a little bit different
Uncaught TypeError: Cannot read property 'offsetWidth' of null
Comment #19
hutch commentedGoogle maps is not happy with something, probably another javascript.
Comment #20
imclean commentedI was still having problems with Megamenu not working on getlocations pages. The problem was megamenu.js using $(document).ready instead of Drupal behaviors.
Megamenu issue: #1458084: Use Drupal behaviors instead of $(document).ready()
Comment #21
hutch commentedSorted!
Comment #22
dgastudio commentedlook, this is default getlocations view
http://medstream.krypton.vps-private.net/getlocations_all
it's works on all pages except on content type display
works
http://medstream.krypton.vps-private.net/consultation/vopros-0
doesnt work
medstream.krypton.vps-private.net/catalog/institutions/medicinskoe-uchrezhdenie
it's the same js, loaded for all pages..
Comment #23
dgastudio commentedit's ok.
clean installation of drupal
content type: test
- getlocations fields
views: getlocations all
- block
- Show map even if view has no results
- place block in any region.
create new node of content type test. fill getlocations fields. save
a is null
REMOVE getlocations fields from TEST content type.
go to previously created node.
the map works!
Comment #24
broonI am now experiencing this error. I am using getlocation-1.1.
There is a content type with getlocations fields and an image field (with unlimited values). Everything works fine, I can add locations to map and upload images. But when I want to delete one image from the list on the node edit page, I hit the remove button and nothing happens.
The error message from Chrome:
Error message from Firefox:
I disabled "Use marker manager" option. Still the same as above.
Then I set the javascript weight to 100 as suggested. The node edit page no longer shows the map and the error changed.
Chrome
Firefox
I tried other weights as `1` and `-1` to no avail.
Comment #25
hutch commentedTry the current dev, it might not fix it but it might behave a bit better.
Please let this thread know what happens.
Comment #26
dmitrii commentedLast dev (2012-Jul-14) fixed the problem with file upload/remove with get location field enabled for me.
Thank you.
Comment #27
pikot commentedIn my case, this error appears when I update the module Search Autocomplete, and none of the solutions above worked for me. Disabling the module Search Autocomplete, the errors disappeared and the map showed again...
Comment #28
hutch commentedI downloaded search_autocomplete-7.x-2.4.tar.gz, installed it on a test rig, configured and enabled the search block, it searches with autocomplete just fine, then went to a node with a map (plus another map in the sidebar showing places nearby) all maps working, no js errors, then tried getlocations search page, that's OK, then tried input map in a new node, no problem at all.
So I cannot reproduce this error ;-(
Comment #29
pikot commentedIn my case search block works with autocomplete too, but it disables all the other javascript on the page an show the "a is null" error. Everything works again if I uninstall the Search Autocomplete. Very strange...
Comment #30
hutch commented