POST
|
I was trying to put it within the constructor, so I was close. I see a lot of potential for dGrid vs DataGrid. I wish there were a few more examples. Mostly I've been looking at http://www.sitepen.com/blog/2011/10/26/introducing-the-next-grid-dgrid/ If you know of other good places to check, please let me know. I'd like to also have this tied to a mouse over event. I need to be able to highlight a feature on the list and have it highlight on the map and vice versa. I have an existing FLEX application and I'm trying to get all the functionality moved into JS. It's not easy! In an example from the 2009 DS, I see someone used dojo.connect (grid, "onRowMouseOver", function () { } but dGrid seems to be different enough that I'm not going to be able to do this. Instead it looks like the grid can be extended to be a SelectionGrid? I think I need to do some more reading. I'm a Flex developer and using all that terminology !
... View more
07-02-2012
10:46 AM
|
0
|
0
|
365
|
POST
|
That was my guess and now it is working! Thanks so much. I'm creating a list of all features on the map, tying it to the map extent to limit just what is shown. I really need the data to be sorted alphabetically, especially when the user is still zoomed out. It looked like the dojox.datagrid had an option to set the sort index, but there doesn't seem to be such a thing in dgrid. I'm thinking I'm going to have to do this on the data before I populate the grid?
... View more
07-02-2012
08:13 AM
|
0
|
0
|
842
|
POST
|
This helps so much, thanks! In the line var template = '<div class="title">Record: ${0}</div><div class="subtitle"><div class="details">This block group has a median age of ${3} and a vacancy rate of ${2}. The percentage of families are ${1}</div>'; what do the numbers 0,1,2,3 relate to? I would have thought this was the order of the attributes from the lines in the callback function, but that doesn't seem to be the case. Do they correspond to the order in the renderTable function?
return {
'med_age': feature.attributes.MED_AGE,
'vacant': feature.attributes.VACANT,
'families': feature.attributes.FAMILIES,
'id': feature.attributes.ObjectID
} innerHTML : dojo.string.substitute(template,[obj.id,obj.families,obj.vacant,obj.med_age])
... View more
07-02-2012
06:05 AM
|
0
|
0
|
842
|
POST
|
What I'm trying to do is pretty different from the example. I have a featureset with a callback function from a queryTask. To begin with, I'm not sure I'm formatting my data correctly for what the grid wants as input. function queryFeatures_callback (featureSet) {
var data = [];
dojo.forEach(featureSet.features,function(feature){
data.push({"facility":feature.attributes.FACILITY},{"address":feature.attributes.ADDRESS},{"city":feature.attributes.CITY} );
});
//create the grid
grid = new dgrid.Grid({
columns: {
Facility: 'facility',
Address: 'address',
City: 'city'
},
renderRow: renderTable,
//this function renders the table in a non-grid looking view
showHeader: false
}, "grid");
grid.renderArray(data);
}
function renderTable(obj, options) {
var template = '<div class="facility">${FACILITY}</div><div class="address">${ADDRESS} </div><div class="city">${CITY}</div>';
var facility = obj.facility;
var address = obj.address;
var city = obj.city;
return div = dojo.create("div",{
innerHTML : dojo.string.substitute(template,[obj.facility,obj.address,obj.city])
});
}
... View more
06-29-2012
11:52 AM
|
0
|
0
|
842
|
POST
|
If I read this correctly, if I use dgrid, I should make sure I'm using version 3.0 of the API?
... View more
06-29-2012
09:05 AM
|
0
|
0
|
842
|
POST
|
I would like to be able to take the attributes from a featureSet and display them more like an mailing address in a pane along side my map. Facility Name Address City, State I see that I can easily put this information in a grid, but then the data is presented as columns and I really want a much smaller footprint on the screen. I know how to do this in Flex using a datagrid renderer, but I don't see that there is such a thing in JavaScript.
... View more
06-29-2012
06:47 AM
|
0
|
14
|
1518
|
POST
|
I have a project that uses clustering and I find the documentation very sparse. I have a sample that draws OK, but there are very few clusters and they have quite a few points in them. What parameters do I need to set to have the clusters be more spread out with fewer points in them. This map covers the whole state and tehre is plenty of space. <esri:FlareSymbol id="flareSymbol"
flareMaxCount="30"
flareSizeIncOnRollOver="2"
sizes="[20,30]"
textFormat="{tf}"
weights="[30,60]"/>
<esri:WeightedClusterer id="clusterer" symbol="{flareSymbol}">
<esri:center>
<!--
x/y values are from the below extent x/y min/max values, these are the center of the extent.
To make sure that you have the same clusters every time and independently of the map size and extent, these values have to set explicity,
or you can let the cluster pick the map center at runtime.
-->
<esri:MapPoint x="{(-14477000-6677000)*0.5}" y="{(2273000+8399000)*0.5}"/>
</esri:center>
</esri:WeightedClusterer> This is from an online sample and I'm pretty sure I need to change the mapPoint to fall in the middle of the state. Does someone have some links a little more detailed explanation on using clustering? It looks really interesting; I can't believe I haven't found more when I've searched on the forums.
... View more
06-15-2012
11:53 AM
|
0
|
1
|
669
|
POST
|
I haven't been able to figure this out, but I do know from looking at the API reference that map and webmap are two different things. So it's going to take more than just a few changes in URL etc to get this to work. I have been successful so far with just adding some lines in the layout.js in the function unitUI. It still relies on the webmap from arcgis.com, but at least I have been add an additional feature layer over the top. It's a start anyway. I inserted these lines after the line map.graphics.add(maxExtentGraphic); I'm having problems with the title of the infoTemplate, basically I'm defining it, but it's not showing up as a title. I think I'm getting infoWindows and popUps confused.
var title = "${FACILITY}";
var content = "<b>${FACILITY}</b>" + "<br>${ADDRESS}" + "<br>${CITY}" ;
var template = new esri.InfoTemplate(title,content);
//var template = new esri.InfoTemplate();
//template.setTitle("hospital");
//template.setContent(content);
var featureLayer = new esri.layers.FeatureLayer("http://myserver/arcgis/rest/services/myserviceName/MapServer/1",{
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
infoTemplate:template
});
var pictureSymbol = new esri.symbol.PictureMarkerSymbol('images/hospital_square.png', 12, 12);
var featureRenderer = new esri.renderer.SimpleRenderer(pictureSymbol);
featureLayer.renderer = featureRenderer;
map.addLayer(featureLayer);
... View more
05-31-2012
11:28 AM
|
0
|
0
|
969
|
POST
|
Are you using your own locator or one from ESRI? I have found that some of the ESRI locators are better about having the best match returned first. Others are pretty sloppy.
... View more
04-03-2012
01:20 PM
|
0
|
0
|
324
|
POST
|
I don't think you can get much more barebones than the samples (not the code gallery) that are presented in the resources center. The challenge is to combine them into something more useful. If you have already downloaded the API (and you probably have) every one of those samples is included in the API download. When I was getting started, the first thing I did was start referencing my own services. The 2nd thing was to use the sample under Mapping > Map Extent and Mouse Coordinates because it helped me change the samples to focus the map extent over my state. There a few other samples under the Concepts tab that were also useful to me.
... View more
04-03-2012
01:16 PM
|
0
|
0
|
277
|
POST
|
I'm answering my own question, but I wanted to post what I hope is the final resolution: I'm not sure why I had an extent set on the query. Somewhere along the line I thought I needed it. I guess for the end users with their different screen sizes and resolutions the extent I'd defined at the start didn't work for them. The map drew OK, but the query was cutting off the counties along the borders. Once I removed coQuery.geometry = mainMap.extent; all was well.
... View more
04-03-2012
01:10 PM
|
0
|
0
|
217
|
POST
|
I have a an application that will let the user make a few selections for a menu and based on their choices runs a querytask generates a cholorpleth map. Because it's dynamic, the querytask and query are both created dynamically within actionscript. This function handles the users selection: protected function btn_loadMap_clickHandler(event:MouseEvent):void { if (categoryList.selectedIndex > -1 ) { //must have selected something from the dropdownlist category = categoryList.selectedItem.data; } if ( mapList.selectedIndex > -1) { mapChoice = mapList.selectedItem.data; } if (!category || !mapChoice) { Alert.show("Please select both a chemical use and map type.", "Need Selections to Generate Map"); } yearValue = radio_yearButtons.selectedValue; if (categoryList.selectedIndex > -1 && mapList.selectedIndex > -1) { classBreakField = category + "_" + yearValue + "_" + mapChoice; mapTitle.text = yearValue + " - " + categoryArrayObj[category] + ", " + mapTopicArrayObj[mapChoice]; lblLegend.text = mapTopicArrayObj[mapChoice] + " - " + yearValue; qryTask_selectedField(); } } Once the selection has been made, the function qryTask_selectedField is called and it creates and executes the query and querytask. This is county based data and all counties should be returned from the query. All fields have some data value in private function qryTask_selectedField ():void { trace ("in qrytask_selectedField function"); graphicsLayer.clear(); mainMap.infoWindow.hide(); var coQryTask:QueryTask = new QueryTask (); coQryTask.showBusyCursor = true; coQuery.geometry = mainMap.extent; coQryTask.useAMF=false; coQryTask.url = "http://" + localpathName + "/arcgis/rest/services/EPHT_AgChemical_county/MapServer/0" coQryTask.addEventListener(QueryEvent.EXECUTE_COMPLETE, coResult); coQryTask.addEventListener(FaultEvent.FAULT, onFault); coQryTask.execute(coQuery); //coQryTask.execute(coQuery, new AsyncResponder( coResult, onFault )); } You can see I started out with an asyncResponder, which I've always used for my querytasks. It worked just great for me every time. The problem is that my test users have not always seeing all the counties shaded in. I changed it around to have listeners on the QueryEvent for EXECUTE_COMPLETE and for the fault. Maybe I'm not correct yet in my syntax. It still works for me and it still doesn't work for my users! In order to see if the number of features was being returns correctly and not just some random color problem from my dynamic class renderer. I put a small label at the bottom of my map. It is set as: <s:Label id="lbl_featureCount" text="Number of features from query:" fontStyle="italic" /> I populate this with the number of features in the featureset. The query should always return 115 features (the number of counties in Missouri). Users have randomly been getting 105, 107, 111 and sometimes all 115. I feel like the query task isn't fully complete before it sets the graphicLayer.graphicProvider, but it's just so random! I thought the queryEvent executecomplete event would take care of it. I will add that these users are actually on the same campus as our AGS server and I'm in another part of town! The coResult function is quite complex. If anyone thinks seeing it will help, I can post as an attachment in a reply. I doubt it will fit in this dialog box! As you can see with my AMF=false, my AGS server is still at version 9.3. Maybe some day we'll be ready to upgrade!
... View more
04-03-2012
11:55 AM
|
0
|
1
|
582
|
POST
|
Where does this go? Does it matter? I'm used to Flex and Actionscript and the order doesn't seem to matter as much there as it does in javascript. Also, does this mean I need to remove the onchange from the <select> tag?
... View more
03-23-2012
05:18 AM
|
0
|
0
|
450
|
POST
|
I'm very new to HTML/JavaScript and I'm surprised not to find an example out there already for this. I would like to let the user pick a county from a list and zoom to that county. I see examples where the users can enter in the name into a text input, but there are a lot of issues with spelling and I'd rather let them choose. I have the dropdown list, but the value selected isn't making it into my doFind function. I've deleted a lot of our counties in this example - Missouri has over 100!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9" />
<!--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>zoomCountyByName</title>
<style type="text/css">
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
<script type="text/javascript">
djConfig = {
parseOnLoad: true
};
</script>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.7">
</script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("esri.tasks.find");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.ComboBox");
var map;
var findTask, findParams;
var countyName, mySelect;
function init(){
var spatialReference = new esri.SpatialReference({
wkid: 102100
});
var startExtent = new esri.geometry.Extent(-10583000, 4287025, -9979000, 4980462, spatialReference);
map = new esri.Map("map", {
extent: startExtent
});
var streetMapLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(streetMapLayer);
//Create Find Task using the URL of the map service to search
findTask = new esri.tasks.FindTask("http://gis.dhss.mo.gov/arcgis/rest/services/county_simple/MapServer");
//Create the find parameters
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["NAME", "NAME2"];
findParams.outSpatialReference = map.spatialReference;
dojo.connect(map, 'onLoad', function(theMap){
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map, map.resize);
});
}
function doFind(){
//Set the search text to the value in the box
countyName = dojo.byId("mySelect").value;
findParams.searchText = countyName;
// findParams.searchText = dojo.byId("mySelect").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 esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 2), new dojo.Color([98, 194, 204, 0.5]));
//create array of attributes
var items = dojo.map(results, function(result){
var graphic = result.feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
return result.feature.attributes;
});
//Zoom back to the initial map extent
var selectedExt = graphic.geometry.getExtent();
map.setExtent(selectedExt);
}
dojo.addOnLoad(init);
</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;">
<select id="mySelect" data-dojo-type="dijit.form.ComboBox" onchange="doFind();" >
<option>Adair</option>
<option>Andrew</option>
<option>Atchison</option>
<option>Audrain</option>
<option>Barry</option>
<option>St. Charles</option>
<option>St. Clair</option>
<option>St. Francois</option>
<option>St. Louis</option>
<option>St. Louis City</option>
<option>Ste. Genevieve</option>
<option>Stoddard</option>
<option>Stone</option>
<option>Sullivan</option>
<option>Taney</option>
<option>Texas</option>
<option>Vernon</option>
<option>Warren</option>
<option>Washington</option>
<option>Wayne</option>
<option>Webster</option>
<option>Worth</option>
<option>Wright</option>
</select>
</div>
<div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>
</div>
</body>
</html>
... View more
03-22-2012
01:31 PM
|
0
|
3
|
950
|
POST
|
That generates a coding error Multiple markers at this line: -1119: Access of possibly undefined property data through a reference with static type mx.core:UIComponent. -infoWindow For some strange reason, the problem I was seeing, where the original graphic that was clicked remembered what it's infoWindowRenderer was from the first click, is no longer a problem. I hate to mark this thread as resolved, because the suggestions I'd applied earlier (and messed with for several hours!) didn't fix it at the time. I haven't been in this code for days and today it's decided to work, even though I haven't made any other changes since?!?!?! Apparently my code is intimidated by your superior knowledge. :rolleyes:
... View more
03-22-2012
09:07 AM
|
0
|
0
|
331
|
Title | Kudos | Posted |
---|---|---|
1 | 03-18-2022 10:14 AM | |
1 | 02-18-2016 06:28 AM | |
1 | 03-18-2024 07:29 AM | |
4 | 08-02-2023 06:08 AM | |
1 | 10-26-2022 08:27 AM |
Online Status |
Offline
|
Date Last Visited |
07-02-2024
10:22 PM
|