|
POST
|
Without running it the only thing that stands out as a possibility is this line. params.geometries = feature.geometry; I think it needs to be passed as an array. params.geometries = [ feature.geometry ]; That's how the ref shows it. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/bufferparameters.htm#geometries Other than that, not too sure.
... View more
08-02-2012
09:03 AM
|
0
|
0
|
3042
|
|
POST
|
Try parseInt on your bufferDist value. This line is returning your value as a string. var bufferDist = $("#inputBuffer").val();
... View more
08-02-2012
08:37 AM
|
0
|
0
|
3042
|
|
POST
|
I don't really use dojo.xhr too often to do my CRUD, but it should look similar to this.
updateData = function(graphic) {
var _args, attr, data, geom;
attr = graphic.attributes;
// JSON methods may not be available in all browsers
// I think dojo.toJson(obj).toString() will
// do the same thing.
geom = JSON.stringify(graphic.geometry.toJson());
data = {
"Geometry": geom
};
_args = {
// my .net service will handle the writing
// to sql server
url: "api/service/" + attr.id,
postData: data,
handleAs: "json"
};
// I think you'd use xhrRawPost for json data,
// I'm not clear on this one.
return dojo.xhrRawPost(_args);
};
Then to read the updated data at a later time.
graphics = []; // array that will hold my graphics
// results would be the response from
// from a REST request via dojo xhr or jquery ajax
dojo.forEach(results, function(result) {
var g, res_geom, res_obj;
// result is JSON, but Geometry is a string field
// convert string field to JSON object
res_obj = dojo.fromJson(result.Geometry);
// convert json to geometry
res_geom = esri.geometry.fromJson(res_obj);
//create my graphic
g = new esri.Graphic(res_geom, symbolHelper.lineSymbol(), {
"Id": attribute.Id,
"WorkOrderId": attribute.WorkOrderId
});
return graphics.push(g);
});
// In this case, I update a FeatureLayer, but you can easily just add
// graphics to a GraphicsLayer
prev_graphics = lineFeatures.graphics;
lineFeatures.applyEdits(graphics, null, prev_graphics);
Hope that helps a bit, I tweaked some stuff from a project for this example to simplify it a bit, but not too much.
... View more
08-02-2012
07:44 AM
|
0
|
0
|
2832
|
|
POST
|
I actually do this a lot. Geometry has a toJson() method, notice the lowercase "son", you guys just had to be different 😉 http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/geometry.htm#toJson I then do a jsonObject.toString() and store this in a string field that gets saved in a SQL table field along with any other data that's required. Then when I get my results from the db, I take that field and convert it to JSON using dojo or jquery or JSON.parse(). I'd avoid using eval if a public facing site, too risky, but once you have the JSON object of the geometry you saved, you can now convert it to a real Geometry with esri.geometry.fromJson. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/namespace_geometry.htm#fromJson Then you can create your graphics to show on the map. t's fast, simple and efficient for basic needs.
... View more
08-02-2012
05:38 AM
|
0
|
0
|
2832
|
|
POST
|
You can send it in the IdentifyParameters with layerDefinitions http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/identifyparameters.htm#layerDefinitions This will filter it before you get the results from the server.
... View more
08-01-2012
09:03 AM
|
0
|
0
|
922
|
|
POST
|
I just tried your site in IE8, Chrome 20, Opera 12 and they all look the same as your expected result. However, they all threw the same error Uncaught TypeError: Cannot call method 'then' of undefined serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dojo/DeferredList.xd.js:8 - This is tied to the Legend as far as I can tell. Opera has a really cool debug feature that separate inline JS into it's own screens to view. It looks like you may have to add an eventListener to the map for the "onLayersAdd" event, and use map.addLayers([lyr1, lyr2]). Right now you're doing map.addLayers([lyr1]) map.addLayers([lyr2]) The creating the legend and running legend.startup(), so it could be the case that the map layers are not fully loaded. The timing of this load can vary, which might explain the inconsistencies you are seeing. As for the tiled look, do you happen to be working behind a proxy? I've seen this happen before, but not consistently and the only thing I could think of was that it may have had to do with working behind a proxy firewall.
... View more
08-01-2012
06:34 AM
|
0
|
0
|
2944
|
|
POST
|
Well, for your first question, you can store some basic data in a cookie. Dojo has a cookie module you can use. http://dojotoolkit.org/reference-guide/1.7/dojo/cookie.html You wouldn't want to store too much stuff, I think cookies have a 4kb limit, but that's plenty to store some config information. As for your second question, not sure. Are you waiting for the "onLayersAdd" event?
... View more
08-01-2012
06:12 AM
|
0
|
0
|
1153
|
|
POST
|
Query debugs like this are best tested at the Query URL of your MapService Something like http://<servername>/ArcGIS/rest/services/<servicename>/MapServer/<layerid>/query It could be something like wrapping () around portion of the query.
... View more
07-25-2012
05:26 AM
|
0
|
0
|
2413
|
|
POST
|
If you use Chrome, you can prettify the JS files that get downloaded with the developer tools to view the code in a readable manner. Some vars are still obfuscated, but it's not too difficult to figure out what's what. I've done this to pull some data out of a couple of dijits.
... View more
07-11-2012
06:11 AM
|
0
|
0
|
1015
|
|
POST
|
Check out the migrating to 3.0 page http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp/migration_30.htm I was able to load the cbtree library as a package and got no errors when I added it to some defines. I didn't try to actually build a tree node though. dojoConfig = { async: 1, parseOnLoad: true, packages: [ { name: "cbtree", location: location.pathname.replace(/\/[^/]+$/, "") + "src/libs/cbtree" } ] }; Then I was able to load it in an app like this. define(['cbtree/Tree', 'cbtree/models/TreeStoreModel'], function(Tree, TreeStoreModel) { return { treeTest: function(){ console.log("cbtree files loaded:", Tree, TreeStoreModel); } }; }); Chrome shows the js files were loaded. The docs for this dijit talk about adding these files to the dojo directory and stuff, which in this simple test wasn't needed. Hope that helps a bit.
... View more
07-09-2012
06:12 AM
|
0
|
0
|
3253
|
|
POST
|
I believe the reason for this a Dojo 1.7 issue and not an ESRI API issue. If run locally, Dojo will try to load the files locally, which is why you get these errors. Let's look at the dojo/text tool. It will load a file as plain text to use in your application, mostly used for templating. This a XHR request, which cannot be done locally and will only work in a server environment. It can be a little annoying if you are not used to keeping a server up locally. If you want a ridiculously easy local server to use, try xampp. http://www.apachefriends.org/en/xampp.html It's a simple, one-click install of apache/mysql/tomcat and more. You can just use it to run apache which will work for running the samples. There's even a version to run it off a usb drive. I've been using it for quite a while at work so I don't need to work off a test server.
... View more
07-05-2012
01:47 PM
|
0
|
0
|
4370
|
|
POST
|
This was discussed in a previous thread, but also make sure that your server environment is configured to serve .json, as that is how the point data for this sample is stored under the "/data" folder.
... View more
06-29-2012
02:35 PM
|
0
|
0
|
2433
|
|
POST
|
Where exactly are you adding this? The measurement.js tool has a field called result. So you can grab measurement.result.toFixed(2) and apply it to the tooltip or some other feature. I actually just use jQuery to grab the results and display them in a "history list". After some trial and error, it was just the simplest route. If you wanted to modify the measurement.js, you may just want to use dojo.extend.
... View more
06-29-2012
06:03 AM
|
0
|
0
|
3109
|
|
POST
|
nvm. What happens if you remove the reference to the arcgis css? Since you're using compact, you may not need it. <link rel=�??"stylesheet" type=�??"text/�??css" href=�??"http:�??/�??/�??serverapi.arcgisonline.com/�??jsapi/�??arcgis/�??2.8/�??js/�??dojo/�??dijit/�??themes/�??claro/�??claro.css">�??
... View more
06-28-2012
09:12 AM
|
0
|
0
|
1872
|
|
POST
|
I add that package in a test app real quick and used a dojo.require "help_panel.HelpPanel" and the js file was downloaded in my app. I don't know what it does or how to use it, but it downloaded. The only thing different in my dojoConfig is I have async: true, but I don't know if that would make a difference in this case.
... View more
06-17-2012
07:16 PM
|
0
|
0
|
1232
|
| 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 |
Offline
|
| Date Last Visited |
a week ago
|