POST
|
Thanks, its been driving me crazy since everything looked correct. Your suggestion worked perfectly!
... View more
12-17-2014
09:30 AM
|
0
|
0
|
750
|
POST
|
Hey guys, I am making a measurement app, and I am adding the measurements on every click as a graphic(point, textSymbol) and I am setting the color to white. Now on the map it shows up as white, but when I print the result, the measurement text comes out black. Cant seem to figure out whats going on, any ideas?
... View more
12-16-2014
05:25 AM
|
0
|
3
|
2609
|
POST
|
thanks, there were some cool stuff in there that I can see myself using.
... View more
09-15-2014
01:45 PM
|
0
|
0
|
373
|
POST
|
Thanks for the reply. I actually started to do that, that's why there's a reference to colorPalette. If the reference is removed, it still shows up for the Text Box.
... View more
09-15-2014
09:55 AM
|
0
|
2
|
373
|
POST
|
Hello, example - jsFiddle Answer - jsFiddle If you look at the example above, when you click a text field a color Palette comes up; is there an easy way to do this for a graphic (eclipse, triangle...) as well? edit - Answer - var myPalette = new ColorPalette({ palette: "7x10", onChange: function(val){ if(grfx.geometry.type==="point") {return;} var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(val); var r = parseInt(result[1], 16) var g = parseInt(result[2], 16) var b = parseInt(result[3], 16) var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,0,0]), 2),new Color([r,g,b,0.75])); grfx.setSymbol(symbol); } }, "colorPal").startup(); On graphic click, I set the symbol to the color palette.
... View more
09-15-2014
09:14 AM
|
0
|
4
|
870
|
POST
|
Thanks that got me in the right direction. Only thing that doesn't work for me is when I add a new tab programmatically, the content doesn't appear. I get a blank button (if there is no tabContainer in the function declaration) and a blank select field if there is a tabContainer in the function declaration. See here: jsfiddle
... View more
08-28-2014
11:41 AM
|
0
|
2
|
925
|
POST
|
<div data-dojo-type="dijit.layout.TabContainer">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Legend'">
</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Search results'">
</div>
</div>
<div data-dojo-type="dijit.layout.TabContainer">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Legend'">
</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Search results'">
</div>
</div>
Hey guys, im trying to figure out how to switch between the tabs from a button (rather than pressing on the tab itself) is there a way to do this? edit - answer: give the div of the tabcontainer and the tab itself an id tag <id="tabconID" div data-dojo-type="dijit.layout.TabContainer"> for tab itself: <div id="tab1Name" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Search results'"></div></div> then in your javascript section do //declare tab var tc = registry.byId("tabconID"); //use to select tab tc.selectChild(registry.byId("tab1Name"));
... View more
08-28-2014
09:30 AM
|
0
|
4
|
6296
|
POST
|
myQueryTask = new QueryTask("http://pslgis.cityofpsl.com/arcgis/rest/services/WastePro/Recycle_Schedule/MapServer/0"); Heres the entire code (jsfiddle)
... View more
08-21-2014
05:44 AM
|
0
|
3
|
612
|
POST
|
oh yup I did leave it out for the sample, my fiddle has it though
... View more
08-21-2014
05:29 AM
|
0
|
0
|
612
|
POST
|
Hey guys, this has been bugging me for a few days. I used the findTask code in the sample and would like to run a querytask once the user clicks a row. I put the query task code in the rowclickHandler function. I put an alert to showthe attributes, but it returns an error saying "an error as occured during task execution". Below is the sample from esri (I put in my querytask just like I did on my own code). !DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Display Find Task results in Dojo DataGrid</title> <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dojox/grid/resources/Grid.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dojox/grid/resources/claroGrid.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } </style> <script src="http://js.arcgis.com/3.10/"></script> <script> require([ "esri/map", "esri/tasks/FindTask", "esri/tasks/FindParameters", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/Color", "dojo/on", "dojo/dom", "dijit/registry", "dojo/_base/array", "dojo/_base/connect", "dojox/grid/DataGrid", "dojo/data/ItemFileReadStore", "dijit/form/Button", "dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( Map, FindTask, FindParameters, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, Color, on, dom, registry, arrayUtils, connect, DataGrid, ItemFileReadStore, Button, parser ) { var findTask, findParams; var map, center, zoom; var grid, store; parser.parse(); registry.byId("search").on("click", doFind); center = [-83.266, 42.568]; zoom = 11; map = new esri.Map("map", { basemap: "streets", center: center, zoom: zoom }); //Create Find Task using the URL of the map service to search findTask = new FindTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/TaxParcelQuery/MapServer/"); myQueryTask = new QueryTask("URL"); map.on("load", function () { //Create the find parameters findParams = new FindParameters(); findParams.returnGeometry = true; findParams.layerIds = [0]; findParams.searchFields = ["OWNERNME1", "OWNERNME2"]; findParams.outSpatialReference = map.spatialReference; console.log("find sr: ", findParams.outSpatialReference); }); function doFind() { //Set the search text to the value in the box findParams.searchText = dom.byId("ownerName").value; findTask.execute(findParams, showResults); } function showResults(results) { //This function works with an array of FindResult that the task returns map.graphics.clear(); var symbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([98, 194, 204]), 2), new Color([98, 194, 204, 0.5]) ); //create array of attributes var items = arrayUtils.map(results, function (result) { var graphic = result.feature; graphic.setSymbol(symbol); map.graphics.add(graphic); return result.feature.attributes; }); //Create data object to be used in store var data = { identifier : "PARCELID", //This field needs to have unique values label : "PARCELID", //Name field for display. Not pertinent to a grid but may be used elsewhere. items : items }; //Create data store and bind to grid. store = new ItemFileReadStore({ data : data }); var grid = registry.byId("grid"); grid.setStore(store); grid.on("rowclick", onRowClickHandler); //Zoom back to the initial map extent map.centerAndZoom(center, zoom); } //Zoom to the parcel when the user clicks a row function onRowClickHandler(evt) { var clickedTaxLotId = evt.grid.getItem(evt.rowIndex).PARCELID; var selectedTaxLot = arrayUtils.filter(map.graphics.graphics, function (graphic) { return ((graphic.attributes) && graphic.attributes.PARCELID === clickedTaxLotId); }); if ( selectedTaxLot.length ) { map.setExtent(selectedTaxLot[0].geometry.getExtent(), true); /////////////////////////////////////////////////////////////////QUERYTASK////////////////////////////////////////////////////////////////////////////////////////////// myQuery = new Query(); myQuery.outFields = ["Service_Da"]; myQuery.geometry = selectedTaxLot[0].geometry; myQueryTask.execute(myQuery, showResults1, errorCallback); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } function showResults1(fs) { //do something with the results //they are returned as a featureset object alert("test"); var al = ""; alert(fs[0].attributes["Service_Da"]); alert(al); } function errorCallback() { alert("An error occurred during task execution"); } }); </script> </head> <body class="claro"> <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%;height:100%;margin:0;"> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'" style="height:40px;"> Owner name: <input type="text" id="ownerName" size="60" value="Katz" /> <button id="search" data-dojo-type="dijit.form.Button" type="button" data-dojo-attach-point="button" >Search </button> </div> <div id="map" data-dojo-props="region:'center'" data-dojo-type="dijit/layout/ContentPane" style="border:1px solid #000;"></div> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'" style="height:150px;"> <table data-dojo-type="dojox/grid/DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'"> <thead> <tr> <th field="PARCELID">Parcel ID</th> <th field="OWNERNME1" >Owner 1</th> <th field="OWNERNME2">Owner 2</th> <th field="RESYRBLT ">Year Built</th> <th field="SITEADDRESS" width="100%">Address</th> </tr> </thead> </table> </div> </div> </body> </html>
... View more
08-21-2014
04:27 AM
|
0
|
9
|
1125
|
POST
|
Ill take a look, thanks a lot! edit - thanks again, this is what I was looking for. Should help me a great deal.
... View more
07-15-2014
07:08 AM
|
0
|
0
|
332
|
POST
|
Hey guys, im fairly new to the javascript API. I made a viewer where the user is able to draw and edit shapes and text. I am trying to figure out how to remove a single graphic that is selected. the code below removes all graphics regardless if its selected or not. anyideas on what Im doing wrong?
map.graphics.on("click", function(evt){
//window.alert("click caught");
event.stop(evt);
editingEnabled = true
if (evt.ctrlKey === true || evt.metaKey === true) { //delete feature if ctrl key is depressed
window.alert("delete caught");
map.graphics.clear(); // removes all graphics as opposed to only selected graphic
currentLayer = this;
editToolbar.deactivate();
editingEnabled=false;
}
});
//FIXED CODE (thanks to tim witt) - just in case anyone came accross the same issue.
map.graphics.on("click", function(evt){
//window.alert("click caught");
event.stop(evt);
editingEnabled = true
if (evt.ctrlKey === true || evt.metaKey === true) { //delete feature if ctrl key is depressed
window.alert("delete caught");
map.graphics.remove(evt.graphic); // this removes single graphic
currentLayer = this;
editToolbar.deactivate();
editingEnabled=false;
}
});
... View more
07-15-2014
06:53 AM
|
0
|
3
|
756
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|