problems with - dojo.connect(map, "onLoad", initFunctionality);

3423
1
09-01-2010 02:08 AM
simonmiles
New Contributor II
Hi there,

I'm having some problems combining the below samples

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_selectionmo... (Map Container Split in Three (Headline)

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_selectionmo... (Identify features on a map)

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_selectionmo... (dojo datagrid)

What i've been able to do is combine the dojo datagrid sample to the Map Constrainer Split in Three sample, but i've hit a sticking point in trying in intergrate the ID feature on a map, sample. The problem revolves around 'dojo.connect(map, "onLoad", initFunctionality);' when i try to add it ****here**** or anywhere around this area of my code i loss my map! I've been playing around but cant seem to work it out. Help!

This is what i've got....

script type="text/javascript">
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("esri.map");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("esri.tasks.find");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.form.Button");
dojo.require("dijit.Toolbar");
dojo.require("esri.tasks.identify");

var map, identifyTask, identifyParams, symbol, findTask, findParams, navToolbar, startExtent;
var grid, store;
var layer2results, layer3results, layer4results;

//this global object contains all references needed across functions

var globals = {};

function init() {
****here**** 
dojo.connect(grid, "onRowClick", onRowClickHandler);
****and tried it here**** 
//Create map and add the ArcGIS Online imagery layer

startExtent = new esri.geometry.Extent(463948.200042408, 163659.035896198, 521987.007515106, 189429.504103801, new esri.SpatialReference({wkid:27700}));
****and tried it here****
map = new esri.Map("map", { extent: startExtent });

full code attached

Thanks
0 Kudos
1 Reply
Kathleen_Crombez
Occasional Contributor III
you cannot call map.onLoad() until after you initialize the map.

try placing it after
map = new esri.Map("map", { extent: startExtent });
0 Kudos