planetfederal / gxp

High level components for GeoExt based applications.
http://boundlessgeo.com/
Other
84 stars 97 forks source link

Fixed broken reference to OpenLayers map object. Currently the following... #126

Closed chrismayer closed 5 years ago

chrismayer commented 12 years ago

... error is thrown: "Uncaught TypeError: Cannot call method 'register' of undefined" when this plugin is being initialized inside a viewer.

chrismayer commented 12 years ago

This change is based on the logic of accessing the OpenLayers map object here: https://github.com/opengeo/gxp/blob/master/src/script/plugins/LayerSource.js#L82

bartvde commented 12 years ago

@chrismayer how can I reproduce this issue? How are you using it? This plugin should be in mapPlugins and not in the tools section.

chrismayer commented 12 years ago

@bartvde I use this within a gxp.Viewer instance inside the tools section, like this:

new gxp.Viewer ({ 

    ...

    tools : [{
            ptype: 'gxp_loadingindicator',
            loadingMapMessage: 'loading...'
        }],

    ...

});

which seems to be wrong according to your comment. What is the best way to find the right way? Did I miss a hint here in the API docs http://gxp.opengeo.org/master/doc/lib/plugins/LoadingIndicator.html ?

bartvde commented 12 years ago

To be honest, it's only mentioned if you look at mapPlugins in the Viewer api docs:

http://gxp.opengeo.org/master/doc/lib/widgets/Viewer.html

mapPlugins Array(Ext.util.Observable) Any plugins to be added to the map panel, e.g. gxp.plugins.LoadingIndicator.

Does it work for you this way?

chrismayer commented 12 years ago

Now it compiles, but unfortunately the loading mask does not appear (without error). But this seems to be a different problem.

Maybe mentioning vice versa in the API docs would be useful to avoid the error I did. So in http://gxp.opengeo.org/master/doc/lib/plugins/LoadingIndicator.html we could say something like "could be used in the 'mapPlugins' array".

If the core developers would give a convention for this (howto tag this for API docs) the docs could be improved by other developers too and the API docs would improve.

What do you think?

Thanks, Chris