|
POST
|
To use outStatistics, the layer has to support Statistics. The layer you are querying does not support it. Here is one feature layer that supports it. Look for Supports Statistics: entry.
... View more
09-11-2013
05:31 AM
|
0
|
0
|
2788
|
|
POST
|
Bill, the code provided just shows you the idea how to use query.outStatistics to get the field statistics, but it won't work with the feature layer in your code. As I mentioned earlier, to use query.outStatistics, the feature layer or the table has to support Statistics. The layer used in your example does not support it. Compare it with this layer, and looking for Supports Statistics:, you will know what I mean. It'd be helpful to understand the sample.
... View more
09-10-2013
07:43 AM
|
0
|
0
|
915
|
|
POST
|
You are welcome, Mark. Glad to help. Please consider mark the thread as "Answered" so other people may find it helpful as well. Thanks.
... View more
09-10-2013
07:01 AM
|
0
|
0
|
528
|
|
POST
|
Below is the revised portion for query. You will need to change other portion accordingly with the new change, mainly the change of the fields returned from the query, and how to present them in the data grid. // get object IDs from the table (feature layer)
featureLayer.on("load", function () {
// create the query to fetch object IDs for earthquakes that have a magnitude greater than 6.0
// that occurred after January 1st 2007
var query = new Query();
query.where = "Magnitude > 6.0 AND Num_Deaths >= 1";
query.timeExtent = new TimeExtent(new Date("01/01/2007 UTC"));
var statisticDefinition = new StatisticDefinition();
statisticDefinition.statisticType = "count";
statisticDefinition.onStatisticField = "name";
statisticDefinition.outStatisticFieldName = "total";
query.outStatistics = [statisticDefinition];
featureLayer.queryIds(query, function (objectIds) {
fetchRecords(objectIds);
});
});
... View more
09-10-2013
06:27 AM
|
0
|
0
|
915
|
|
POST
|
Make use of query.outStatistics. Here is a sample. In order to use this feature, the layer or the table has to Support Statistics when published. require([
"esri/tasks/Query", "esri/tasks/StatisticDefinition", ...
], function(Query, StatisticDefinition, ... ) {
var query = new Query();
var statisticDefinition = new StatisticDefinition();
statisticDefinition.statisticType = "count";
statisticDefinition.onStatisticField = "Name";
statisticDefinition.outStatisticFieldName = "Total";
query.outStatistics = [statisticDefinition];
...
});
... View more
09-09-2013
02:30 PM
|
0
|
0
|
915
|
|
POST
|
Add below to your CSS file assuming "map" is the id of the map div element. Change width and height as you like. #map .atiTextAreaField {
height: 100px;
width: 200px;
}
... View more
09-09-2013
09:09 AM
|
0
|
0
|
528
|
|
POST
|
Good point, Ken! This is another way to union the extents one by one, and it should perform on the client side for a little performance gain.
... View more
09-09-2013
08:07 AM
|
0
|
0
|
1501
|
|
POST
|
Here is a sample code to zoom to one layer's extent. If you need to zoom to the extent of multiple layers, you will need to get the extent of each layer using esri.request, and use geometryService.union to get the extent to cover all the layers, and zoom the map to it. esri.request({
url: mapService.url + "/" + lyrId,
content: {
f: "json"
},
handleAs: "json",
callbackParamName: "callback"
}).then(function (jsonLayer) {
// NOTE: jsonLayer.extent is not a real Extent object, but just a json object
map.setExtent(new esri.geometry.Extent(jsonLayer.extent));
});
... View more
09-09-2013
07:38 AM
|
0
|
0
|
1501
|
|
POST
|
Prior to //Create data object to be used in store var data = { identifier: "OBJECTID", label: "LSData", items: items }; Go through the items loop, and convert the item attribute in need to number. Here is a sample. var fldNameConvert = "fldConvertion"; var newItems = dojo.map(items, function(item) { var newItem = dojo.clone(item); newItem[fldNameConvert] = parseInt(newItem[fldNameConvert]); return newItem; }); var data = { identifier: "OBJECTID", label: "LSData", items: newItems };
... View more
09-09-2013
07:10 AM
|
0
|
0
|
1891
|
|
POST
|
ok. I see what's happening. The formatter function only affects how the data presents in the data grid. The sort operation still uses its value, not the returned value from the formatter function. Obviously, the values you tried to sort are the type of string. What I would suggest is to convert all the values to numbers before feeding the data into the data grid, so the data grid recognizes the values are number types, and will sort them like that.
... View more
09-07-2013
06:44 PM
|
0
|
0
|
1891
|
|
POST
|
Here is the sample code to extract the layer info from each dynamic map service. You can easily modify to add each layer name into a dropdown list. config.layers = [];
dojo.forEach(map.layerIds, function(aLayerId) {
var serviceLayer = map.getLayer(aLayerId);
if ("layerInfos" in serviceLayer) {
dojo.forEach(serviceLayer.layerInfos, function(aLayerInfo) {
config.layers.push({
name: aLayerInfo.name,
mapService: serviceLayer.id,
layerId: aLayerInfo.id
});
});
}
});
... View more
09-06-2013
10:18 AM
|
0
|
0
|
3510
|
|
POST
|
Try: function PAOFormat(item) {
return dojo.string.pad(item, 3);
} Have you considered to switch to the new data grid, dGrid? It's much better in terms of the performance and functionality. Here is the link for lots of examples. Other useful links: http://www.sitepen.com/blog/2011/10/26/introducing-the-next-grid-dgrid/ http://dojofoundation.org/packages/dgrid/tutorials/hello_dgrid/
... View more
09-06-2013
10:02 AM
|
0
|
0
|
1891
|
|
POST
|
After some thoughts, actually customizing the BasemapGallery is a working way to implement your theme switcher. Andy provides a sample code. Here is the idea. Build each map layer using BasemapLayer. Build each map theme using Basemap fed with the list of basemap layers built in step 1. Build a BasemapGallery instance fed with the map themes built in step 2. Here is the sample code assuming you are using AMD style. If non-AMD style, then replace the class name with the fully qualified names, like esri.dijit.BasemapGallery for BasemapGallery. Be sure to set showArcGISBasemaps to false. var mapLayer1 = new BasemapLayer({url:"mapService1/rest/url"});
var mapLayer2 = new BasemapLayer({url:"mapService2/rest/url"});
var mapLayer3 = new BasemapLayer({url:"mapService3/rest/url"});
var mapTheme1 = new Basemap({
layers: [mapLayer1, mapLayer2],
title: "Map Theme 1",
thumbnailUrl:"images/mapTheme1.png"
});
var mapTheme2 = new Basemap({
layers: [mapLayer1, mapLayer3],
title: "Map Theme 2",
thumbnailUrl:"images/mapTheme2.png"
});
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: false,
basemaps: [mapTheme1, mapTheme2],
map: map
}, domConstruct.create('div')); Hope it helps.
... View more
09-06-2013
07:18 AM
|
0
|
0
|
860
|
|
POST
|
Instead of using CheckedMenuItem, I would use Select or regular MenuItem to set the selection mode since the three selection modes should be mutually exclusive, meaning only one selection mode should be set. Below sample uses MenuItem. <div data-dojo-type="dijit.Menu" id="selectionoptionsMenu">
<div data-dojo-type="dijit.MenuItem" id="newSelection">New Selection</div>
<div data-dojo-type="dijit.MenuItem" id="addSelection">Add Selection</div>
<div data-dojo-type="dijit.MenuItem" id="substractSelection">Subtract Selection</div>
</div> JS code: var selectionMode;
function init() {
dojo.connect(dijit.byId("newSelection"), "onClick", function() { selectionMode = esri.layers.FeatureLayer.SELECTION_NEW; });
dojo.connect(dijit.byId("addSelection"), "onClick", function() { selectionMode = esri.layers.FeatureLayer.SELECTION_ADD; });
dojo.connect(dijit.byId("substractSelection"), "onClick", function() { selectionMode = esri.layers.FeatureLayer.SELECTION_SUBTRACT; });
// ...
}
When make selection, featureLayer.selectFeatures(selectQuery, selectionMode);
... View more
09-05-2013
07:12 PM
|
0
|
0
|
577
|
|
POST
|
Jeff's overall idea is better than mine. Here is what I would do. Define an app controller module, module/app.js. define(["dojo/_base/lang", "dojo/dom", "dojo/on", ...], function(lang, dom, on, ...) {
return {
init: function() {
on(dom.byId("chkbox1_ID"), "change", lang.hitch(this, function(evt) {
this.chk1_onChange(evt, param1, param2);
}));
},
chk1_onChange: function(evt, param1, param2) {
// respond to the event
}
};
}); Inside the index.htm, <script>
var dojoConfig = {
parseOnLoad: true,
async: true,
packages: [{
name: "module",
location: "/path/to/module"
}]
};
</script>
<script src="http://js.arcgis.com/3.6/"></script>
<script>
require(["module/app", "dojo/domReady!"], function(app) {
app.init();
});
</script> You can define all the event handlers in app.js so to keep HTML for the page layout, and JS file for the business logic.
... View more
09-04-2013
02:21 PM
|
0
|
0
|
2272
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-17-2013 05:16 AM | |
| 1 | 11-06-2013 04:34 AM | |
| 1 | 08-29-2013 10:58 AM | |
| 6 | 10-20-2020 02:09 PM | |
| 1 | 11-20-2013 06:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-17-2024
08:41 AM
|