Fusion onInitialize query

1 message Options
Embed this post
Permalink
Cristi Teodoreanu

Fusion onInitialize query

Reply Threaded More More options
Print post
Permalink
(This post was updated on )
I'm trying to create a custom query for a layer filtering when the map loads. Basically the code I'm executing in the var fusionInitialized function is:

var map = Fusion.getWidgetById('Map');
var options = {};
options.maxFeatures = 0;
options.layers = '(Points)';
options.filter = '(PointNr LIKE \'%007%\')';
map.query(options);

However, the query execution throws an exception:

Fusion Error:
WARNING: Exception occurred in AJAX callback.
Message: invalid label
Location: http://localhost:8008/mapguide/fusion/MapGuide/MapGuide.js (774)
Response: ERROR: Argument is null.
Argument is null.
Exception occurred in method MgResourceIdentifier.CheckName at line 624 in file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\common\platformbase\Services/ResourceIdentifier.cpp

- MgMap.Open line 457 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\common\mapguidecommon\MapLayer/Map.cpp
- MgResourceIdentifier.CheckName line 624 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\common\platformbase\Services/ResourceIdentifier.cpp


I have debugged the query process from MapGuide.js  - query : function(options) - adding the alert massage as shown below:
//....
var ajaxOptions = {
            onSuccess: OpenLayers.Function.bind(this.processQueryResults, this, zoomTo),
            parameters: params};
/* >>>>>> */ alert('mapname: '+params.mapname+'\nsessionid:'+params.sessionid+'\nlayers: '+params.layers+'\nfilter: '+params.filter);
        Fusion.ajaxRequest(loadmapScript, ajaxOptions);
//......

The message shows that at the execution of the query both the mapname and sessionid are not defined for the map

mapname: undefined
sessionid:undefined
layers: (Points)
filter: (PointNr LIKE '%007%')

Q: Since the fusionInitialized is registered to be executed on Fusion.Event.FUSION_INITIALIZED, what is the problem with the above test ?
My idea was that the map should have been fully loaded by then and the filter queried ok.

Thank you,
Cristi Teodoreanu