|
POST
|
You'll want to listen to the 'onLayerAdd' event when adding individual layers. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/map.htm#onLayerAdd So something like dojo.connect(map, 'onLayerAdd', function(){ alert(basemap.layerInfos[0].name); }); map.addLayer(basemap); Right now you're trying to access the layerInfos immediately after adding it to the map, but you have to wait for it to finish loading before you can interact with it. You might even be able to listen to the individual layers onLoad, but I haven't tried that way. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/layer.htm#onLoad
... View more
12-12-2012
12:44 PM
|
2
|
0
|
1580
|
|
POST
|
Ok, got it. My widget template had the following as the html template for my button.
<button data-dojo-type="dijit.form.Button" data-dojo-attach-point="buttonWidget"
data-dojo-attach-event="onClick:_onFlowTraceClick">Trace</button>
I have to add button="type" to that or it defaults to a type of submit, which only seems to affect IE at least version 8. I guess I just needed to write it down to work it out. Maybe this will help someone else that comes across this problem.
... View more
12-12-2012
11:00 AM
|
0
|
0
|
743
|
|
POST
|
Oddly enough, I just saw this thread right now and found I am having the same error with something I am working on right now, but a different scenario, so I made a new thread. This only happens in IE8, which is what I need to support in my office. It works fine in Chrome and FF, so I'm not sure what the problem is. I am using esri.request to submit parameters to a non-arcgis web service. However, in IE8 it is appending the parameters the application pages URL and refreshing the page when I send the request. I am using a dijit/form to collect and submit data on a (non-submit) dijit.form.button. I can tell it's not the form submitting because I can see my console debugs before the request happens. Here is the onClick event handler for my form.
_onFlowTraceClick: function(e) {
e.preventDefault();
e.stopPropagation();
var form = registry.byId('flowTraceForm');
var data = form.getValues();
console.log('values?', data);
var _this = this;
var url = '/csdapi/api/flow/trace';
var params = {
id: data.name,
direction: data.direction,
districts: data.nodetype === 'districts'
};
var len = data.status.length; // an array of checkboxes
while(len--) {
params[data.status[len]] = true;
}
console.log('params for trace', params); // I see all debug consoles up to here
var request = esri.request({
url: url,
content: params
});
request.then(function(response, io) {
console.log('got a response!', response, io);
response.bubble = true;
response.cancelable = true;
_this.emit('flowTraceResults', response);
});
}
When it reaches the esri.request() line it appends the parameters to the pages URL, so my app can be http://testgis/demo and it turns into http://testgis/demo?id=999&nodetype=local&direction=up and my page refreshes. It's just weird. *edit, it looks like it might be the form.getValues() causing an issue, because the params it adds to my URL match the form and not the custom params I make. I do have a proxy.ashx set up with mustMatch=false for dev purposes and I can see it working in Chrome and FF. Has anyone else seen this happen before?
... View more
12-12-2012
10:27 AM
|
0
|
1
|
1295
|
|
POST
|
Try adding showAttribution: false to the constructor parameters. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/map.htm#MapConst var map = new esri.Map('mapdiv', { showAttribution: false });
... View more
12-10-2012
01:52 PM
|
0
|
0
|
2863
|
|
POST
|
That puts a smile on my face. Thanks for the links!
... View more
12-07-2012
08:52 AM
|
0
|
0
|
2446
|
|
POST
|
I agree with Jeff. I think prior to 1.7, some of the Dojo modules seemed clunky, but the documentation has vastly improved since then and Dojo provides just about everything I need to get things done. As a matter of fact, I have eliminated all third-party libraries from my projects. My comments on the Dojo/Dijit annoyances have more to do with css customizations, because it just seems like a lot of divs in divs with multiple class names get created and it can get a little tricky at times. jQueryUI isn't much different in that respect though, so pOtatoe, potAtoe.
... View more
12-07-2012
05:55 AM
|
0
|
0
|
2446
|
|
POST
|
I use Bootstrap, but only the CSS and not the jQuery stuff anymore. Technically it's just Bootstrap, since the main dev of the project left Twitter. http://twitter.github.com/bootstrap/ When it comes to styling the built-in esri/dojo dijits, it may not do exactly as you want and there may be some conflicts between the two in terms of class names. You can make a custom build of the stylesheet from the bootstrap page to leave out Forms styles for example. Bootstrap will also add styles for DOM elements like tables, forms, lists and so on. Bootstrap won't just plug-in to the dijits, you'll need to either wrap them in something like a form/table or use something like dojo/dom-class to add the Bootstrap defined styles to a dijit. http://dojotoolkit.org/reference-guide/1.7/dojo/dom-class.html Another option is to look at how Bootstrap does some of it's styling and try to mimic it on Dijit elements. One of Dojos annoying Dijit qualities is the amount of classnames and dom elements that get created in a dijit, so you may have to get creative. I have a sample that demonstrates using Bootstrap (and Backbone.js) to create a ToC/Legend Menu that may be if use. http://www.odoe.net/apps/legendtoc/ The source is on github https://github.com/odoe/legendtoc Hope that helps a bit.
... View more
12-06-2012
08:32 AM
|
0
|
0
|
2446
|
|
POST
|
Looking at the Layer list, index 19 is a group layer and 23 is a member of that group. http://servicesbeta2.esri.com/arcgis/rest/services/Water_Network/MapServer So by specifying service.setVisibleLayers([19,23]), you are asking for the whole group of layers. Index 19 will take precedence over the individual layer of 23. If you omit index 19 and only use service.setVisibleLayers([23]), I think you get your desired result. Just remember when you specify the index of a group layer, you are bringing all layers in that group. Hope that helps a bit.
... View more
12-03-2012
12:00 PM
|
0
|
0
|
1370
|
|
POST
|
Are there any estimates (ballpark even) on when the ESRI API will fully support the Dojo 1.7 (and higher) toolkit? I'm having a very difficult time trying to mash both loaders together (dojo.require alongside require()) One example: the esri.Map object doesn't implement Dojo's "Evented" mixin..., so I can't use the 'dojo/on' module Has anyone been successful in utilizing both Dojo versions in tandem? Thanks! -Jackson A good habit at this point would be to load modules like dojo/_base/connect, dojo/_base/array, dojo/dom, ... etc. This way you can avoid needing to do things like dojo.connect(), dojo.forEach(). I don't think I have read that the dojo.function() methods will go away, but I know it's suggested to not do it anymore. http://dojotoolkit.org/reference-guide/1.8/releasenotes/migration-2.0.html I agree though, I like to think the dev team is working behind the scenes looking ahead to Dojo 2.0 to migrate the required modules to the Evented method. It's probably a large task under the hood so as to not break stuff thoughout the API. You can still build you modules with Evented. I build out all my modules and widgets with Evented so that I can do things like a connect event and bubble it with this.emit(). So far, I have had pretty good luck using things like below to load esri modules to the esri namespace. I don't think I use dojo.require() for anything I'm doing anymore. define(['esri/tasks/identify'], function(){/* stuff* /});
... View more
12-03-2012
08:43 AM
|
0
|
0
|
624
|
|
POST
|
How about if you listen to the window resize? dojo.connect(window, 'resize', map.resize); I changed mine from this to what you had, to listen to the dijit.byId('map') and it did not resize when I maximized in IE8, but I always just listen for the resize event of the window anyway and it's always worked for me. It may have to do with some css as well if Kelly could not reproduce.
... View more
11-14-2012
01:15 PM
|
0
|
0
|
1590
|
|
POST
|
Are you looking to extend the template picker or build something custom? I've had a couple of scenarios where I needed to create data that wasn't tied to a map service, so I made a drag and drop utility with custom symbols. Here is a sample http://www.odoe.net/apps/dndeditdemo/ Here is the source https://github.com/odoe/AGSDragDropHandler Combine that with the Editor widget and a FeatureLayer and you should be flying. It might help out.
... View more
11-02-2012
08:30 AM
|
0
|
0
|
883
|
|
POST
|
Someone shared this on twitter the other day when the API went down. This example uses jQuery, but could be applied to any CDN library that you also want to host locally. http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go/1014251#1014251
... View more
10-31-2012
11:10 AM
|
0
|
0
|
1629
|
|
POST
|
The link geos_rfleet provided has everything you need. If you assign the connect method to a variable, you can disconnect it at a later time. so var handle = dojo.connect(item, 'event', function(){...}); then anywhere else in your code, you need to release that connected event dojo.disconnect(handle);
... View more
10-31-2012
05:41 AM
|
0
|
0
|
1237
|
|
POST
|
Might be some maintenance. This happens to me when doing some odd-hour dev, but usually clears up pretty quick. All my apps are down too, but such is the risk of using an external cdn. Gives me time to play with some other stuff.
... View more
10-29-2012
10:21 AM
|
0
|
0
|
2698
|
|
POST
|
If I understand correctly, you can also pass it what I believe is referred to as a function maker. var _funcMaker = function(type) { return function(queryResults) { // do something with results based on type // that was passed to it }; }; findTask.execute(findParams, _funcMaker("find")); The _funcMaker function will take any 'extra' params you want to use and return the function that processes the queryResults.
... View more
10-17-2012
01:02 PM
|
0
|
0
|
2100
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 05-19-2026 02:12 PM | |
| 1 | 04-24-2026 11:01 AM | |
| 2 | 04-21-2026 07:06 AM | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM |
| Online Status |
Online
|
| Date Last Visited |
2 hours ago
|