|
POST
|
Here's a very simple workaround: before your script tag that references the JS API, include this in a script tag:
// fix for https://bugs.dojotoolkit.org/ticket/17400
!document.firstChild.children && (document.firstChild.children = true);
Ideal place would be where you define dojoConfig. Here's a working example: http://jsbin.com/OmUjAmI/1
... View more
09-03-2013
11:25 AM
|
0
|
0
|
444
|
|
POST
|
Thanks everybody. We're testing fixes. We do not plan to modify what's currently hosted on serverapi.arcgisonline.com but will likely post patched versions of the API on js.arcgis.com. Applying the fix will require you to change the URL your app uses for the JS API. For instance, if you use 2.8 from serverapi:
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/"></script>
To get a patched equivalent, once we upload patched versions, you'll update your app to use:
<script src="http://js.arcgis.com/2.8/"></script>
I'll post here when we're further along in this process and/or if anything changes. Thanks for being patient.
... View more
08-29-2013
02:59 PM
|
0
|
0
|
444
|
|
POST
|
We're looking into the best way to fix this. Can everyone in this thread post the version of the JS API they're using?
... View more
08-28-2013
10:59 AM
|
0
|
0
|
1285
|
|
POST
|
Circle is an svg circle element. Depending on the type of symbol you're using, this could be different. Dig into the markup for the map to find out what you need to use in your selector: http://cl.ly/image/2Q103V093M1S
... View more
08-28-2013
08:07 AM
|
0
|
0
|
1480
|
|
POST
|
The pulse effect is causing strange problems for me though in Chrome (it bounces around the screen when you pan). That's been a recurring but intermittent issue with Chrome for a while...I don't know of a fix. I have an idea for another effect, but I would need a selector for just that one graphic from the graphics layer. I don't suppose that's possible? This is brittle but works:
#blink_layer circle:first-child {
-webkit-animation-duration: 3s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: pulse;
-moz-animation-duration: 3s;
-moz-animation-iteration-count: infinite;
-moz-animation-name: pulse;
}
This will be easier with 3.7 as we're adding a way for you to put custom data-* attributes on graphics you create. You can then target those graphics with css selectors and style one or groups of graphics a particular way.
... View more
08-27-2013
10:07 AM
|
0
|
0
|
1480
|
|
POST
|
The key thing to pick up on is that the element you want to style gets an ID of <layer-id>_layer. So, if you add a graphics layer with: var gl = new GraphicsLayer({ id: "blink" }); Your CSS would look like: #blink_layer { -webkit-animation-duration: 3s; -webkit-animation-iteration-count: infinite; -webkit-animation-name: pulse; -moz-animation-duration: 3s; -moz-animation-iteration-count: infinite; -moz-animation-name: pulse; } Full example: http://jsbin.com/iLuMAwE/1/edit We've got a couple things related to this coming up at the next release and we'll have more docs/examples for this kind of thing.
... View more
08-26-2013
05:01 PM
|
0
|
0
|
1480
|
|
POST
|
myFunction is not available in the global scope, which is where it needs to be if you want it to run via an onclick attribute of an html element. You could create myFunction as a global by putting:
var myFunciton;
at the root of your script tag and then:
myFunction = function() {
alert("Do Something");
}
But that's the wrong way to do this. In general, it's bad practice to add onclick handlers via markup. Mixing JS and markup is not a good habit to develop. Instead, get a reference to your element (could use dojo/dom.byId or dojo/query) and bind a click handler with dojo/on.
... View more
08-26-2013
09:11 AM
|
0
|
0
|
3663
|
|
POST
|
appreciate that. I can load it from my index.html as long as i path to it correctly right? Yep. also, what about defining the components properly so in the third function i can use "query" instead of "dojo.query"? My mistake, missed those refs initially. Do what zj_zou says: load your dependencies using an array of module identifiers for the first arg to define(). Also make sure you return the object you create like so:
define(["dojo/dom", "dojo/query"], function(dom, query) {
return {
getType: function(value) {
var type = "config.json";
switch (value) {
case "test":
type = "config-test.json";
break
case "landdevelopment":
type = "config-landdevelopment.json";
break
case "utilitiesinfrastructure":
type = "config-utilitiesinfrastructure.json";
break
default:
type = "config.json";
}
return type;
},
getFormattedServiceType: function(value) {
var type = "Property Locator";
var newValue = (value.replace(".json", "")).replace('config-', '');
switch (newValue) {
case "test":
type = "Test";
break
case "landdevelopment":
type = "Land Development";
break
case "utilitiesinfrastructure":
type = "Utilities Infrastructure";
break
default:
type = "Property Locator";
}
return type;
},
getAllNamedChildDijits: function(id) {
// Gather all child widgets
var w = null;
var children = null;
widgets = {};
w = query("[widgetId]", dom.byId(id));
children = w.map(dijit.byNode);
children.forEach(function(item, idx) {
if (item.name) {
widgets[item.name] = item;
}
});
return widgets;
}
}
});
Here's a test page that loads and calls two of your functions (I renamed common.js from my previous example to common-deps.js):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.6/js/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
}
</style>
<script>
var dojoConfig = {
paths: {
utilities: location.pathname.replace(/\/[^/]+$/, "")
}
}
</script>
<script src="//js.arcgis.com/3.6/"></script>
<script>
var map;
require([
"esri/map",
// "utilities/common",
"utilities/common-deps",
"dojo/domReady!"
], function(
Map, common
) {
map = new Map("map", {
basemap: "streets",
center: [ 19.291, 48.343 ],
zoom: 4
});
console.log("all of common", common);
console.log("common.getType(\"test\"):", common.getType("test"));
console.log("common.getAllNamedChildDijits(\"map\"):", common.getAllNamedChildDijits("map"));
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
... View more
08-21-2013
08:42 PM
|
0
|
0
|
737
|
|
POST
|
So swapping http://js.arcgis.com/3.6/init.js for http://js.arcgis.com/3.6compact/init.js in a test application increases the amount of http requests by 75... from 132 to 207....yet the total amount of data transferred is 1.5Mb in both cases (the increased number of requests makes up for the smaller size of the build itself). Right, use a smaller build of the API but loading the same modules will result in more requests to load the same amount of JS. I believe this speaks to the broader issue that if the CDN is the promoted way to refer to the API, than there should actually be sensible build layers provided that use idiomatic Dojo build practices to reduce HTTP requests. We're long overdue on this. We've occasionally discussed creating additional build layers and making those available but we never finalized exactly what we wanted to do so we never did it. AMD is a dependency management system which lends itself to good building, but if you don't build AMD slows you down. I think the JS API team may need to look harder at the issue of build layers and what is best provided by a CDN (ie 4-6 larger files vs. 150 small ones). Also, building small AMD files into layers can reduce them 5-10% just due to inlining, reducing total bytes sent. This would likely be a win for server load also, as there would be less concurrent requests to negotiate. Alternatively, providing the uncompressed source or even putting the API on github would provide immense benefit to both developers and the API itself. I have fixed several bugs in my own uncompressed source (when it was accidentally released a view versions ago), and I'd love for an easy way to incorporate these back into the community. Doesn't get much easier than a pull request. Anyhow cheers, and looking forward to more action in this area. The next thing that's going to happen in this area is a web app that will let you build custom versions of the API (the plan also includes an option for Esri to host your build(s), but you can also download and host yourself). This is what Steve (evtguy) is talking about when he mentioned stuff I talked about at the UC this year. No public timeline on this yet. The API will not be in a public Github repo in the near future. If you've found bugs, please report them through support. If that's too much trouble, you can email me the bugs you've found and fixed: dswingley@esri.com.
... View more
08-21-2013
08:10 PM
|
0
|
0
|
735
|
|
POST
|
You can pass an object to define() that defines your utility functions. Put this in common.js:
define({
getType: function(value) {
var type = "config.json";
switch (value) {
case "test":
type = "config-test.json";
break
case "landdevelopment":
type = "config-landdevelopment.json";
break
case "utilitiesinfrastructure":
type = "config-utilitiesinfrastructure.json";
break
default:
type = "config.json";
}
return type;
},
getFormattedServiceType: function(value) {
var type = "Property Locator";
var newValue = (value.replace(".json", "")).replace('config-', '');
switch (newValue) {
case "test":
type = "Test";
break
case "landdevelopment":
type = "Land Development";
break
case "utilitiesinfrastructure":
type = "Utilities Infrastructure";
break
default:
type = "Property Locator";
}
return type;
},
getAllNamedChildDijits: function(id) {
// Gather all child widgets
var w = null;
var children = null;
widgets = {};
w = dojo.query("[widgetId]", dojo.byId(id));
children = w.map(dijit.byNode);
children.forEach(function(item, idx) {
if (item.name) {
widgets[item.name] = item;
}
});
return widgets;
}
});
Put this in load-common.html in the same directory as common.js:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.6/js/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
}
</style>
<script>
var dojoConfig = {
paths: {
utilities: location.pathname.replace(/\/[^/]+$/, "")
}
}
</script>
<script src="//js.arcgis.com/3.6/"></script>
<script>
var map;
require([
"esri/map",
"utilities/common",
"dojo/domReady!"
], function(
Map, common
) {
map = new Map("map", {
basemap: "streets",
center: [ 19.291, 48.343 ],
zoom: 4
});
console.log("common", common);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
... View more
08-21-2013
10:03 AM
|
0
|
0
|
737
|
|
POST
|
It's not clear from our documentation, but the purpose of getLayersVisibleAtScale is to determine whether or not a layer's min and max scale would cause a layer to be visible or not. If you want to know whether or not a layer is currently shown on the map, do what you're doing and check layer.visible. If both are true, the layer is currently displayed on the map.
... View more
08-20-2013
08:52 AM
|
0
|
0
|
671
|
|
POST
|
Instead of assuming that an object (a graphic in this case) will always have a particular property, it's safer to check for its existence first. With your code, instead of trying to access graphic.attributes.OBJECTID right away, do this:
function zoomRow(id) {
selectionLayer.clear();
dojo.some(map.graphics.graphics, function (graphic) {
if (graphic.hasOwnProperty("attributes") &&
graphic.attributes.hasOwnProperty("OBJECTID") &&
graphic.attributes.OBJECTID.toString() === id) {
var selectedState = new esri.Graphic(graphic.geometry)
.setAttributes(
graphic.attributes);
selectionLayer.add(selectedState);
//Zoom to the extent of the parcel - expand it a bit so we aren't zoomed in too close.
var stateExtent = selectedState.geometry.getExtent();
map.setExtent(stateExtent);
return true;
}
});
}
... View more
08-19-2013
05:26 PM
|
0
|
0
|
634
|
|
POST
|
The clustering sample loads a .json file and creates clusters from it.
... View more
08-19-2013
05:22 PM
|
0
|
0
|
551
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-23-2012 07:54 AM | |
| 1 | 05-28-2010 08:31 AM | |
| 1 | 11-12-2012 08:12 AM | |
| 3 | 02-23-2012 10:57 AM | |
| 1 | 06-27-2011 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|