|
POST
|
The onShow event for the tab itself is what you want. Tab container doesn't have an event to return the "active" tab and/or to let you know that a tab has been changed. It does have myTabs.selectedChildWidget, which is the selected tab (literally the widget). on(tab1, 'show', function() {
//do stuff
});
on(tab2, 'show', function() {
//do stuff
});
//and so on Then perhaps call a function to handle the web map creation. on(tab3, 'show', function() {
switchWebMap('WEB_MAP_ID');
});
switchWebMap function(id) {
//do stuff
}
Sorry, I don't know much about ago web maps, but hope this helps with your tabs. Have you been to the dojo Reference Guide and the API Documentation. Most everything you need for developing with dojo.
... View more
12-06-2013
08:37 AM
|
0
|
0
|
1350
|
|
POST
|
Heads up. The Map with a Dojo dGrid sample is throwing the following error: esri.layers.FeatureLayer: unable to find 'NW1M_CY' field in the layer 'fields' information [url: http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Net_Worth/MapServer/4] The service does not have a 'NW1M_CY' field.
... View more
12-05-2013
07:11 PM
|
0
|
1
|
861
|
|
POST
|
Instead of removing and re-adding layers, I would just listen for the onRendererChange event. Something like: on(featureLayer, 'renderer-change', function() {
var extent = graphicsUtils.graphicsExtent(featureLayer.graphics).expand(1.5);
map.setExtent(extent, true);
});
... View more
12-05-2013
06:55 PM
|
0
|
0
|
914
|
|
POST
|
You should be able to identify a raster simply by publishing it as map service, and identifying with a point. I do it with LiDAR data sets to get spot elevations, and to generate profiles by creating points along a line and using the results with dojox/charting to visualize it. Identify returns pixel value and stretched value (0-255).
... View more
12-05-2013
04:22 PM
|
0
|
0
|
3969
|
|
POST
|
It's strange that esri.bundle would be undefined. The full api and compact should load esri.bundle based on your locale automatically every time. It's a component of the api creating the esri namespace. Without it there are no string values for anything the api does involving the display of text. Jeff - thanks for pointing out that obscure documentation. Need to backtrack on a couple items I thought were wrapped up.
... View more
12-03-2013
12:38 PM
|
0
|
0
|
1713
|
|
POST
|
I recently ran into some trouble binding menus to graphics and this is what I learned. //create graphic
if (result.geometry.type != 'extent') {
var graphic = new Graphic(result.geometry);
} else {
var graphic = this._extentToPolygon(result.geometry);
}
//add graphic
this.layer.add(graphic);
//graphic menu
graphic.menu = new Menu({
contextMenuForWindow: false,
leftClickToOpen: false
});
//add some menu items
graphic.menu.addChild(new MenuItem({
label: 'Move to Front',
onClick: lang.hitch(this, function() {
graphic.getDojoShape().moveToFront();
})
}));
graphic.menu.addChild(new MenuItem({
label: 'Move to Back',
onClick: lang.hitch(this, function() {
graphic.getDojoShape().moveToBack();
})
}));
//bind the menu to graphics dom node
graphic.menu.bindDomNode(graphic.getDojoShape().getNode());
I was creating graphics, each with a custom menu based on geometry type and such, then binding the menu to the graphics dom node. The menu was initially bound to graphic's dom node, however any number of actions appear to magically unbind the menu. These include, but are not limited to, panning/zooming the map and editing the graphic's symbol or geometry. Looking for answers led me to explore regions of the jsapi I had never ventured into before, as well as, getting to know dojox/gfx. GFX being the vector graphics api that powers esri graphics and graphic layer types. Turns out there there is a lot going on with graphics and graphic layers; way more than I had expected. While the layer object contains all of its graphics in the DOM, a graphic may not have a dom node in the GFX surface. This makes sense when you think about a layer being hidden or a graphic being outside the extent of the map (the GFX surface). The jsapi is destroying and creating shapes (vector objects) whenever a layer refreshes or a graphic's geometry/style properties are updated. As a result the initial dom node the menu was bound to no longer exists. So how to keep the menu bound to the dom node which is currently representing our graphic? My first thought was to rebind the menu when updating the geometry and style, and by iterating through graphics on layer events, which seemed excessive and messy. I ended up using the layer's "mouse-over" event to bind the menu to whatever dom node is representing the graphic. After having spent a day diagnosing the problem and coming up with a solution I happened upon the Display context menu in the samples. The sample also uses the "mouse-out" event to unbind the menu, which is best practice for dom nodes that may be destroyed. on(this.layer, 'mouse-over', function(evt) {
evt.graphic.menu.bindDomNode(evt.graphic.getDojoShape().getNode());
});
on(this.layer, 'mouse-out', function(evt) {
evt.graphic.menu.unBindDomNode(evt.graphic.getDojoShape().getNode());
}); In conclusion: 1) Always check the samples. There's a chance it may save you time and hassle. 2) Check out dojox/gfx. The demos and test folders here are great for learning about GFX and will enlighten even long time jsapi developers.
... View more
11-25-2013
12:11 PM
|
0
|
2
|
3713
|
|
POST
|
I'm working on some classes and widgets for updating graphic symbols and have found it much easier/less code to update the svg shapes directly instead of creating and setting esri/symbols. The problem is that graphic.symbol does not update when using this approach. I don't see any method, public or private, to update graphic.symbol from the svg. Does anyone know of some way to accomplish this within the api-as-is before I write a class extension to do so? Thanks.
... View more
11-19-2013
01:42 PM
|
0
|
0
|
877
|
|
POST
|
Thanks Derek. That's what I was thinking, just wanted to make sure. Thanks again.
... View more
11-15-2013
09:28 AM
|
0
|
0
|
759
|
|
POST
|
When defining a module is there a good reason to define declare as a variable and then return the variable as opposed to returning declare directly? I see/do it both ways, and can't tell a difference. Is it the developers preference? I'd like to pick one and go with it across the board is why I ask. Thanks. define(['dojo/declare', 'dojo/Evented'], function(declare, Evented) { var someClass = declare([Evented], { //blah blah }); return someClass; }); OR define(['dojo/declare', 'dojo/Evented'], function(declare, Evented) { return declare([Evented], { //blah blah }); });
... View more
11-15-2013
08:31 AM
|
0
|
2
|
883
|
|
POST
|
I looked at your code again and noticed you are using dijit/layout/AccordionPane. AccordionPane is depreciated and it probably doesn't have dojo/on mixed in or something like that. Use dijit/layout/ContentPane.
... View more
11-07-2013
09:01 AM
|
0
|
0
|
2089
|
|
POST
|
Use registry.byId() for on show. require(['dijit/registry'], function(registry) {
on.once(registry.byId('measureTab'), 'show', function() {
measurement.startup();
});
});
... View more
11-07-2013
07:41 AM
|
0
|
0
|
2089
|
|
POST
|
You need to define it. require(['dojo/on'], function(on) {
});
... View more
11-06-2013
12:45 PM
|
0
|
0
|
2089
|
|
POST
|
Andrew, 1) in the constructor you don't need need to byId; just the srcRefNode id 2) onShow with tab to startup the measure 3) use AMD var measurement = new Measurement({
map: app.map
}, 'measurement');
on.once(registry.byId('measureTab'), 'show', function() {
measurement.startup();
});
[HTML]<div id="measureTab" data-dojo-type="dijit/layout/AccordionPane" title="Measurement"> <div id="measurement"></div> </div>[/HTML]
... View more
11-06-2013
11:49 AM
|
0
|
0
|
2089
|
|
POST
|
One thing I'm trying to remember is if I delete a well point, does the relationship class delete the related records or do I have to handle that in my code? The database handles it. http://resources.arcgis.com/en/help/main/10.2/index.html#/Create_Relationship_Class/0017000000mn000000/ Expanding on my last post: if you don't update the actual feature object's attributes client-side when updating the database, the user is not going to see those updates, nor will the api (in a default info template for example) until the layer refreshes that feature for some other reason than an independent update. I can think of several instances where this could be a problem with feature layers. One of the great things about a feature layer is that it's kinda like a feature class in ArcMap, in that it's features are the data (geometry and attributes). The api does a lot to reduce server calls by querying and such client-side when it can. If you load a feature layer in SNAPSHOT mode, you have essentially loaded the entire data set in the map just like adding a feature class in ArcMap.
... View more
10-30-2013
09:47 AM
|
0
|
0
|
1052
|
|
POST
|
I'm surprised that you have to include geometry. A feature can be a related table record, i.e. no geometry. Also, you've already selected a feature from the feature layer or otherwise have a hold of it somehow. Why not just update the feature and use it instead of creating a new one? I have a dataset with static geometry/attributes, but several related tables that the user edits. The feature is the record whether it has geometry or not. The snippet below is for an inspector that updates related table records, but any input method could be used to directly update a feature's attributes.
this.inspector.on('attribute-change', lang.hitch(this, function (result) {
var feature = result.feature;
var atts = feature.attributes;
for (var i in atts) {
if (i === result.fieldName) {
atts = result.fieldValue;
}
}
this.applyEdits(null, [feature], null, function (a, u, d) {
console.log(u[0]);
}, function (error) {
console.log(error);
});
}));
... View more
10-30-2013
08:38 AM
|
0
|
0
|
5076
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2013 06:56 AM | |
| 1 | 06-30-2015 09:17 AM | |
| 1 | 10-12-2013 07:14 AM | |
| 1 | 02-05-2014 11:05 AM | |
| 1 | 05-28-2015 11:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|