I've just uploaded a demo to http://webrocket.ulmb.com/
Thanks to someone on IRC, I seem to have fixed error 1 by changing my return in the GMap2 function to: return this[0].GMap2; and then defining the function in the namespace: jQuery.fn.GMap2 = jQuery.gmapp.GMap2 However, when I call the method, I need to include the [0] in the call: $("#gmap")[0].GMap2.setCenter(new GLatLng(53.1767260605,-20.3427745698), 2); Is there any way around this? I'm assuming it's a similar issue for bug 2, but still not sure how to fix that within the scope of the plugin. On 7/11/07, Tane Piper <[EMAIL PROTECTED]> wrote:
Hi folks, Thanks you some of you already on IRC who have helped me with this, but I've got to a point where I'm hitting a brick wall with my plugin. Let me just explain it first. Google Map Application (gmapp) is my first plugin for jQuery, and aims to provide a fully functional application in jQuery for interactive with Google Map and Geocoder API. What I am trying to do is make is as generic as possible, although the plugin is initially being designed for my own CakePHP-powered application. With the current version here: http://pastebin.ca/614176 I am trying to make both the Google GMap2 and GClientGeocoder objects available to the user. However, I am not having any luck. At the moment I have 2 main errors: 1) in a page where I return one or more points from the database, I would like to be able to do this: $('#gmap').gmapp(); $('#gmap').GMap2().setCenter(new GLatLng(55.899956, -3.087158)); However, with the way I currently have the code, I get an error that $('#gmap').GMap2() is not a function. So it does not seem to be getting returned. 2) Before, I was creating the geocoder by doing: var geocoder = new GClientGeocoder(); I then passed this geocoder into the method searchAddress, which worked fine. But now I'd like to make the object global by making it available through this.GGeocoder. In my code, I have tested it in the console, and it appears the initial GGeocoder is being initialised, but when i then try and do an address search, I get the error: this.GGeocoder has no properties; This is at the first line inside the searchAddress method. Now, ANY help on either of these matters would be appreciated. I've read over the jQuery plugin docs, and had a look inside a couple of plugins, but so far nothing has jumped out at me how to fix these errors. -- Tane Piper http://digitalspaghetti.tooum.net This email is: [ ] blogable [ x ] ask first [ ] private
-- Tane Piper http://digitalspaghetti.tooum.net This email is: [ ] blogable [ x ] ask first [ ] private