POST
|
I think I resolved my issue. I was mistaken about it being the dojo is undefined error, I was conflating it with the dojo.body() is null or undefined. Basically what I was doing was that I was working with templated widgets and initializing the member variables to esri items. eg:
dojo.provide("blah.BlahBlah");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.declare("blah.BlahBlah", [dijit._Widget, dijit._Templated],
templateString: "<div style='display: none;'></div>",
hover: new esri.layers.GraphicsLayer({id:"hover"}),
...
} This seemed to cause a race condition in IE. Moving that initialization to startup seemed to resolve the issue. I'm still testing this, but it seems to have fixed it for me.
... View more
10-25-2010
10:02 AM
|
0
|
0
|
883
|
POST
|
I'm having a similar issue. Some machines will receive this error intermittently in IE6, and the 1st time they log onto the page in IE8. It seems to be fine in Chrome and FF though. Looking on the web, there seems to be a history of this in dojo. Old bug report which was resolved: http://bugs.dojotoolkit.org/ticket/2280 Slow connections? http://forums.novell.com/novell-product-support-forums/identity-manager/im-userapp-workflow/389077-error-ie-6-0-dojo-undefined.html Not exactly sure what it is, but I'd like to get rid of it. Does anyone have a workaround? Also is v2.1 the new version? is it safe to use with 9.3.1? The documentation for 9.3.1 doesn't make a reference to that one. (http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_dojo.htm)
... View more
10-21-2010
01:35 PM
|
0
|
0
|
883
|
POST
|
Since you're sending an array with geometry (as opposed to graphics), point your code to a 10 geometry service: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer See http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/migration_20.htm I knew it was something stupid...should have gotten more sleep last night. I kept looking at the function and wondering what was wrong. In my head I kept thinking I wanted to convert one point to another. But anyway...Thanks 🙂
... View more
05-28-2010
10:23 AM
|
0
|
0
|
388
|
POST
|
to resize my map I put an onresize on the body itself which calls a function to recalculate the content div. HTML
<body class="tundra" onresize="onPageResizeHandler()">
<form id="form1">
<div id="header">
</div>
<div id="leftcolumn" dojotype="dijit.layout.ContentPane">
</div>
<div id="center" dojotype="dijit.layout.ContentPane">
<div id="map" style="width:1200px; height:600px; border:1px solid #000;"></div>
</div>
</form>
</body>
JS
function onPageResizeHandler() {
var _header = dojo.marginBox(dojo.byId("header"));
var _leftcolumn = dojo.marginBox(dojo.byId("leftcolumn"));
var windowsize = getWindowSize();
_height = windowsize.h - _header.h;
_width = windowsize.w - _leftcolumn.w;
var centerbox = dojo.marginBox(dojo.byId("center"), {
h: _height,
w: _width
});
var leftcolumnbox = dojo.marginBox(dojo.byId("leftcolumn"), {
h: _height
});
var centerbox2 = dojo.marginBox(dojo.byId("center"));
centerbox2.l = 0;
centerbox2.t = 0;
dojo.publish("ResizeMap", [centerbox2]);
};
The publish basically calls a function and passes the center div measurements to it
var mapDiv = dojo.byId(this.map.id);
dojo.style(mapDiv, {
left: contentBox.l + "px",
top: contentBox.t + "px",
width: contentBox.w + "px",
height: contentBox.h + "px"
});
this.map.resize();
this.map.reposition();
Looks kind of cumbersome but it works in all browsers without getting into overly complicated CSS if you just want the map to be 100% height and width in a div tag on the page.
... View more
05-28-2010
08:08 AM
|
0
|
0
|
898
|
POST
|
I'm trying to do a basic sample of using the Geometry Service Project method, and I can't seem to get it working. I know I'm probably just doing something stupid and can't spot it. I've loaded the map and that's all working, I'll just post the code for the project.
dojo.require("esri.map");
function onProjectComplete(graphics)
{
console.log(graphics);
}
function onError()
{
console.log("Error");
}
function doStuff()
{
console.log("dostuff");
var geoservice = new esri.tasks.GeometryService("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var sourcewkid = new esri.SpatialReference({ "wkid": 2263 });
var destwkid = new esri.SpatialReference({ "wkid": 4326 });
var point = new esri.geometry.Point(975762, 171410, sourcewkid);
console.log(sourcewkid, destwkid, point);
try
{
geoservice.project([point], destwkid, onProjectComplete, onError);
}
catch(err)
{
console.log(err);
}
var infoTemplate = new esri.InfoTemplate("Test","test: ${test}");
var attr = {"test":"test"};
var sms = new esri.symbol.SimpleMarkerSymbol().setStyle(
esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE).setColor(
new dojo.Color([255,0,0,0.5]));
var test = new esri.Graphic(point, sms, attr, infoTemplate);
map.graphics.add(test);
}
I keep getting an error saying "TypeError: Cannot read property 'spatialReference' of undefined" in chrome. And an error in Firefox firebug ""_63f[0].geometry is undefined".
... View more
05-28-2010
07:49 AM
|
0
|
2
|
1820
|
POST
|
That looks promising, thank you for the help. Not sure if it'll fit my needs but it's a great place to start...thanks again.
... View more
05-26-2010
08:30 AM
|
0
|
0
|
195
|
POST
|
I was wondering if there was a way to modify the way the info window resizes around it's anchors itself. What don't I like? Currently it anchors to the upper left or right and lower left or right. So if you set the size, it expands the same way the anchor is declared. What I want? I want it to use up more of the screen. I'd prefer if I could have it span the top left AND right of a graphic. Can anyone recommend a way to modify it to do this? or do I have to create some new widget to accomplish this? -Thanks
... View more
05-25-2010
02:08 PM
|
0
|
2
|
421
|
POST
|
I'm having an issue getting information from an ARCGIS REST service using a dojo service store. The store is created successfully, and I can query the search part of it from a custom .NET RPC Webservice. But when I try to do a query on an ESRI REST service it gives me an error. The error I'm recieving is: Unable to load <URL> status: 0 The URL is the correct URL that corresponds to a query layer REST service with the correct querystring parameters. Anyone have any experience with this? SMD File
{
SMDVersion:"2.0",
contentType:"application/json",
services: {
Search: {
transport: "POST",
envelope: "JSON-RPC-2.0",
target: "/services/testRpc.ashx?rpc",
parameters: [
{name:"search", optional: false},
{name:"start", optional: true},
{name:"count", optional: true}
]
},
query: {
transport: "GET",
envelope: "URL",
target: "http://arcserver/ArcGIS/rest/services/Development/test/MapServer/0/query",
parameters: [
{name:"where", optional: false},
{name:"returnGeometry", optional: false, "default":"true"},
{name:"outFields", optional: false, "default":"loc_code"},
{name:"f", optional: false, "default":"pjson"}
]
}
}
}
ServiceStore
dojo.declare("doe.data.myStore", dojox.data.ServiceStore,
{
constructor: function()
{
console.log("myStoreconstructor");
svc = new dojox.rpc.Service("/SchoolRpc.smd");
this.service = svc.search;
this.idAttribute = "a";
this.labelAttribute = "b";
},
fetch: function(/* object */ request)
{
console.log("myStore fetch");
var rq = dojo.mixin({}, request.query);
if (rq && (!rq.action || rq.action === "search"))
{
this.service = svc.search;
rq.search = request.query.search;
rq.start = request.start;
rq.count = request.count;
}
else if (rq.action === "load")
{
this.service = svc.query;
rq.where = "id='" + rq.id + "'";
rq.returnGeometry = "true";
rq.outFields = "id";
rq.f = "pjson";
delete rq.id;
delete rq.action;
}
request.query = rq;
return this.inherited(arguments);
},
_processResults: function(results, def)
{
console.log("myStore _processResults",results.total);
this._totalResults = results.total
return results;
},
_totalResults:0,
_svc:null
});
JS Code for Fetching data
request = store.fetch({
query:{ action:"load",id:"29" }
});
... View more
04-22-2010
04:15 PM
|
0
|
0
|
660
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|