|
POST
|
1) You are using programmatic selection already, so 'selecting' a feature from a list of already selected features doesn't make much sense in this context. However, there are many ways around this. Without rewriting most of your application, you could simply change the symbology of your 'selected' feature, while resetting the symbol of your other graphics back to the default. Something like this:
function selectState(e) {
// select the feature
var fl = app.map.getLayer("NAME");
var features = fl.getSelectedFeatures();
var symbol = fl.getSelectionSymbol();
var id = parseInt(e.target.innerHTML);
var selectedGraphic;
arrayUtils.forEach(features, function(feature){
if(feature.attributes.OBJECTID === id){
selectedGraphic = feature;
}
feature.setSymbol(symbol);
});
var mySymbol = new SimpleMarkerSymbol().setOutline(null).setColor("#AEC7E3");
selectedGraphic.setSymbol(mySymbol);
app.map.centerAt(selectedGraphic.geometry.getExtent().getCenter());
}
2) Clicking the image does not work in your sample because you're setting the objectID based on the contents of the cell itself in this line: query.objectIds = [parseInt(e.target.innerHTML)]; You won't need a query if you implement the function in step 1.
... View more
04-28-2014
02:45 PM
|
0
|
0
|
2074
|
|
POST
|
This is a function I use to calculate the extent of an array of Graphic objects.
_calcGraphicsExtent: function (graphicsArray) {
var g = graphicsArray[0].geometry,
fullExt = g.getExtent(),
ext, i, il = graphicsArray.length;
if (fullExt === null) {
fullExt = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
for (i = 1; i < il; i++) {
g = graphicsArray.geometry;
ext = g.getExtent();
if (ext === null) {
ext = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
fullExt = fullExt.union(ext);
}
return fullExt;
}
... View more
04-28-2014
01:47 PM
|
0
|
0
|
3044
|
|
POST
|
I don't see anything immediately wrong with your code. Could you recreate the issue using jsfiddle.net so I can take a closer look? Thanks!
... View more
04-25-2014
01:15 PM
|
0
|
1
|
1796
|
|
POST
|
Ideally you would convert your resulting measurement data to another spatial reference. As you said, the Measurement widget works with Web Mercator (102100) and geographic coordinate systems (4326).
... View more
04-25-2014
01:11 PM
|
0
|
0
|
2842
|
|
POST
|
Hi and welcome to the forums! Here is a sample from our documentation showing exactly what you want. https://developers.arcgis.com/javascript/jssamples/widget_home.html Please take the time to read the documentation on both our API and the DOJO library.
... View more
04-25-2014
12:59 PM
|
0
|
0
|
1333
|
|
POST
|
You had said earlier that it was a reference to the div, but if its not, then you are all set 🙂
... View more
04-25-2014
09:54 AM
|
0
|
0
|
2530
|
|
POST
|
Hi, I guess it about enable geolocation in a webView. There is sample in http://turbomanage.wordpress.com/2012/04/23/how-to-enable-geolocation-in-a-webview-android/ and it solved the problem. Thank. Glad you found a solution! I figured it would be an Android issue and not a JSAPI issue 😉
... View more
04-25-2014
09:24 AM
|
0
|
0
|
1514
|
|
POST
|
A reference to the map's div won't work. You need a reference to the map object itself. Also, as posted earlier, use addLayer(), not add().
map.addLayer(subeventsGraphicsLayer);
One more thing: it looks like you are using both legacy and AMD style DOJO in your code. I would suggest using AMD exclusively.
... View more
04-25-2014
09:18 AM
|
0
|
0
|
2530
|
|
POST
|
Hi, I am working on the measurement widget, and it seems that the out of box 'esri/dijit/Measurement' widget is always based on Web-Mercator projection. This makes the measurement result not as accurate as local projection if I understand correctly. Is there a way to use local projection to do the measurement by using this widget? Or I must build a fresh new widget from scratch by myself if I want to get accurate measurement result? Thanks, Wei You only really need the conversion algorithm for Web-Mercator to your local projection. With this, you could modify the widget to fit your needs or convert the values after a measurement event.
... View more
04-25-2014
08:59 AM
|
0
|
0
|
2842
|
|
POST
|
Sorry I can't put it into a js fiddle, its way to complicated. But currently I am using a jquery for each to take the graphics and push each one into a variable that I defined as a array and then I am pushing the graphics into it. I am then taking the graphics array and adding the array to a new esri.layers.GraphicsLayer. And I am trying to push the graphics layer to the map. Currently I am getting an error that self._map.add(GraphicsLayer) is undefined. I have been debugging and I can see self._map is finding the div object map however it doesn't seem to be able find the add function. Matthew, It's not as complicated as you think 🙂 It just takes some genuine effort. I was able to create a sample for you, hopefully it helps. http://jsfiddle.net/ECq4Z/
... View more
04-25-2014
08:56 AM
|
0
|
0
|
2530
|
|
POST
|
var data = array.map(results.features, function(feature) { return { "id": feature.attributes[outFields[0]], "NAME": feature.attributes[outFields[2]], "WATERBODY": feature.attributes[outFields[3]], "ACCESSAREA": feature.attributes[outFields[5]], "LOCATION": feature.attributes[outFields[9]] } }); This is wrong because outFields[5] and outFields[9] do not exist in your application. This is your current outFields array: outFields = ["OBJECTID", "SITENAME", "WATERBODY", "ACCESSAREA", "LOCATION"]; outFields[0] is "OBJECTID", outField[1] is "SITENAME" etc. There are five elements so anything up to outFields[4] is valid. outFields[9] returns undefined. You can confirm this by checking your current store implementation. Out of curiosity, where did you come up with outFields[9]? This is valid: var data = array.map(results.features, function(feature) { return { "id": feature.attributes[outFields[0]], "SITENAME": feature.attributes[outFields[1]], "WATERBODY": feature.attributes[outFields[2]], "ACCESSAREA": feature.attributes[outFields[3]], "LOCATION": feature.attributes[outFields[4]] } }); Another option is: var data = array.map(results.features, function(feature) { return { "id": feature.attributes["OBJECTID"], "SITENAME": feature.attributes["SITENAME"], "WATERBODY": feature.attributes["WATERBODY"], "ACCESSAREA": feature.attributes["ACCESSAREA"], "LOCATION": feature.attributes["LOCATION"] } }); As for the data not showing up in the grid, you are missing several key pieces in addition to fixing your data store. 1) You are using a columnSet. You need to bring in the columnSet module in your require: "dgrid/ColumnSet" / ColumnSet 2) Use columnSet in your grid definition: gridNoColumnSets = new (declare([Grid, Selection, ColumnSet]))({... 2.5) Rename your grid to something else 🙂 3) Set the columnSets property of your grid: gridNoColumnSets.set("columnSets", columnExample2);
... View more
04-24-2014
01:14 PM
|
0
|
0
|
3460
|
|
POST
|
If you are seeing that error message, it means the proxy was not correctly configured (or the path could be wrong).
... View more
04-24-2014
12:17 PM
|
0
|
0
|
890
|
|
POST
|
Aside from a potential syntax error, what error messages do you see in the console? Could you create a sample using jsfiddle so I can see your progress so far? Also check out this sample if you haven't already: https://developers.arcgis.com/javascript/jssamples/graphics_add.html
... View more
04-24-2014
12:09 PM
|
0
|
0
|
2530
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-26-2014 09:56 AM | |
| 1 | 09-18-2014 11:50 AM | |
| 1 | 09-19-2014 11:28 AM | |
| 1 | 07-09-2014 01:43 PM | |
| 1 | 07-09-2014 02:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-14-2024
05:31 PM
|