|
POST
|
Hi, I am trying to show a grid in a dialog box to display the results of a query task. The query task returns results and the "store" gets created with the correct data in it. But when the dialog box displays, the grid does not show up. I have similar code in the app that works, but I can't figure out why the grid doesn't show with the code below. I have made sure there are no duplicate html ids and parseOnLoad = true. Is there something obvious I'm missing? Thanks, Joan Here's the HTML: [HTML] <div dojoType="dijit.Dialog" id="paresultsDialog" title="Plan Amendment Results" data-dojo-props="draggable:false"> <div id="parowcountdisplay"></div><br \> <div>Click on column heading to sort the list.<br />Click on a row(s) to zoom to the plan amendment area(s) on the map.</div> <div id="pasearchresults" class="panel_content" dojoType="dijit.layout.ContentPane" > <!-- <table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'10', rowSelector:'5px', selectionMode:'single'"> --> <table data-dojo-type="dojox.grid.EnhancedGrid" data-dojo-id="gridpastore" id="gridpa" data-dojo-props="rowsPerPage:'10', rowSelector:'5px', selectionMode:'single', plugins:{exporter:true}"> <thead> <tr> <th width="100px" field="OBJECTID">Result Id</th> <th width="100px" field="JURISDICTION">Jurisdiction</th> <th width="150px" field="NAME">Plan Amendment</th> </tr> </thead> </table> </div> </div>[/HTML] Here's the javascript: function showPAResultsGrid(results) {
console.log("-->inside showPAResultsGrid");
var resultcount = results.features.length;
console.log("# of query result objects passed into function: " + resultcount);
var features = results.features;
//Close the 'searching' dialog box.
dijit.byId("searchingDialog").hide();
if (resultcount > 0) {
//console.log("-->inside resultcount loop");
//Open the dialog box to display results in a grid.
dijit.byId("paresultsDialog").show();
//Display number of results in the dialog box header.
dojo.byId('parowcountdisplay').innerHTML=resultcount+" results.<br/>"+ configOptions.selectpanote + configOptions.maxrecordcount + ".";
//Don't clear graphics because that wipes out the buffer graphic.
//map.graphics.clear();
//clearAllGraphicsLayers();
//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]));
var symbol = new esri.symbol.SimpleFillSymbol(resultfillSymbol);
// //create array of attributes and add graphic to map.
var items = dojo.map(features, function(feature){
var graphic = new esri.Graphic(feature.toJson());
//Setting the symbology here sets it for all features in results.
graphic.setSymbol(symbol);
map.graphics.add(graphic);
//console.log("after adding graphic");
return feature.attributes;
});
//Create data object to be used in store
var data = {
identifier: "OBJECTID", //This field needs to have unique values
label: "OBJECTID", //Name field for display. Not pertinent to a grid but may be used elsewhere.
items: items
};
console.log(data.items);
//Create data store and bind to grid.
var store = new dojo.data.ItemFileReadStore({
data: data
});
console.log(store);
//Grid used in the results pop-up dialog.
var gridpa = dijit.byId('gridpa');
gridpa.setStore(store);
}
//Alert user in case plan amendment is not found, 5/15/13 jms.
else {
dialogAlert("Search Plan Amendment", "No plan amendment(s) found.");
}
}
... View more
05-15-2013
12:27 PM
|
0
|
4
|
3539
|
|
POST
|
Okay, after playing with it some more, I modified it to the following which works. Thanks, Greg, for leading me in the right direction. var extent = new esri.geometry.Extent(feature.geometry.getExtent());
var xmin = extent.xmin;
... View more
05-09-2013
12:45 PM
|
1
|
0
|
3268
|
|
POST
|
//Get the extent of the feature.
var extent = feature.getExtent();
var xmin = extent.xmin; Unfortunately that throws the error: TypeError: feature.getExtent is not a function
... View more
05-09-2013
12:32 PM
|
0
|
0
|
3268
|
|
POST
|
I am trying to get the xmin, ymin, ymax, xmax values from a feature's extent to use in a "Zoom To" hyperlink. The code throws an error on the line xmin = feature.getExtent().xmin -- saying xmin is undefined. I'm sure it's something simple (?), but I can't figure out how to get at these values. If I hardcode the values, the code (listed below) works fine. But I need to set the values based on the feature. Can anyone shed some light on this? Thanks - Joan function getParcelInfoWindowContent(idParcelInfoResults) {
console.log("-->inside getParcelInfoWindowContent");
//idParcelInfoResults are the results of an Identify Task on the parcel layer.
//Only want to show the 1st Parcel (so hardcode i=0 and don't loop thru the results).
i=0;
var idParcelInfoResult = idParcelInfoResults;
console.log("idParcelInfoResult.layerId: " + idParcelInfoResult.layerId);
console.log("idParcelInfoResult.layerName: " + idParcelInfoResult.layerName);
console.log("idParcelInfoResult.displayFieldName: " + idParcelInfoResult.displayFieldName);
//Create a feature set. This will contain only the first result.
var featureArray = {displayFieldName:idParcelInfoResult.displayFieldName,features:[]};
featureArray.features.push(idParcelInfoResult.feature);
console.log("featureArray length = " + featureArray.length);
//var feature = idParcelInfoResult.feature;
var feature = featureArray.features;
console.log("feature geometry type: " + feature.geometry.type);
//highlight the feature on the map.
symbol = new esri.symbol.SimpleFillSymbol(highlightfillSymbol);
feature.setSymbol(symbol);
map.graphics.add(feature);
//Get the extent of the feature.
var xmin, ymin, ymax, xmax;
// xmin = feature.getExtent().xmin;
// ymin = feature.getExtent().ymin;
// xmax = feature.getExtent().xmax;
// ymax = feature.getExtent().ymax;
xmin = -9215700;
ymin = 3216400;
xmax = -9119800;
ymax = 3256100;
//create the content for the Parcel tab.
var parCp = new dijit.layout.ContentPane({
title: idParcelInfoResult.layerName,
content: layerParcelInfoTabContent(featureArray,idParcelInfoResult.layerName) //creates content of each tab.
});
//Get the FOLIO number to pass to the Land Use Acreage query task.
//console.log("FOLIO: " + featureArray.features.attributes['FOLIO']);
var folio = featureArray.features.attributes['FOLIO'];
console.log("FOLIO: " + folio);
//Call the query task function.
doQueryFolio(folio);
//create the content for the Land Use Acreage info.
var luCp = new dijit.layout.ContentPane({
title: "Land Use",
content: "<div id='luContent'></div>"
});
//({'xmin':-17893.572423357622,'ymin':6709881.59745682,'xmax':-12385.329072411998,'ymax':6714133.407158158,'spatialReference':{'wkid':102100}})
//var zoomToLink = "<a href='#' onclick=map.setExtent({'xmin':-17893.572423357622,'ymin':6709881.59745682,'xmax':-12385.329072411998,'ymax':6714133.407158158,'spatialReference':{'wkid':102100}});>Zoom To</a>";
var zoomToLink = "<a href='#' onclick='zoomTo(" + xmin + ","+ ymin + "," + xmax + "," + ymax + ");'>Zoom To</a>";
console.log("g_luHTML: " + g_luHTML);
var printLink = "<a href='#' onclick='printElement("parLanduse")'>Print</a>";
console.log("printLink: " + printLink);
var popupContent = zoomToLink + " " + printLink + "<br /><br /><div id='parLanduse'>" + luCp.content + "<br/><br/>" + parCp.content + "</div>";
console.log("popupContent: " + popupContent);
//Make a content pane to hold all the info in the popu window.
var cp = new dijit.layout.ContentPane({
style: "width:100%;height:100%;"
}, dojo.create("div", { innerHTML: popupContent }));
return cp.domNode;
}
function zoomTo(xmin,ymin,xmax,ymax) {
console.log("-->inside zoomTo");
console.log("xmax: " + xmax);
//var extent = new esri.geometry.Extent({"xmin":-9215700,"ymin":3216400,"xmax":-9119800,"ymax":3256100,"spatialReference":{"wkid":102100}});
var extent = new esri.geometry.Extent({"xmin":xmin,"ymin":ymin,"xmax":xmax,"ymax":ymax,"spatialReference":{"wkid":102100}});
map.setExtent(extent,true);
}
... View more
05-09-2013
12:00 PM
|
0
|
4
|
7595
|
|
POST
|
Kelly, Thanks for the reply and code. It was a big help. I copied it into my app (based on the Basic Viewer template), but for some reason your "printPopupContents" function didn't work for me. I got the following in Firebug: [INDENT]-->inside printPopupContents popupContent: [object HTMLDivElement] <div id="esri_dijit__PopupRenderer_1" class="esriViewPopup" widgetid="esri_dijit__PopupRenderer_1">[/INDENT] The browser window that opened showed: [INDENT][object HTMLDivElement][/INDENT] Not sure what's happening there... But, I created my own "printPopupContents" function and used the class attribute to query the dom element (the table inside the popup). Clunkier than your code but it seems to work fine. Here's my function, maybe it helps someone else. function printPopupContents(){
console.log("-->inside printPopupContents");
var popupTable = dojo.query(".attrTable");
console.log("popupTable.length: " + popupTable.length);
console.log("popupTable[0].innerHTML: " + popupTable[0].innerHTML);
popupTableContent = "<table>" + popupTable[0].innerHTML + "</table>";
popupContent = '<html><head><title>Rezoning Print Window</title>';
/*optional stylesheet*/
//popupContent += '<link rel="stylesheet" type="text/css" href="css/rezoning.css" />';
popupContent +='</head><body>';
popupContent += popupTableContent
popupContent +='</br><div>';
popupContent += configOptions.owner;
popupContent +='</div>';
popupContent +='</body></html>';
//write contents to new page for printing
var newWindow = window.open("", "PopupContents");
console.log(popupContent);
newWindow.document.write(popupContent);
}
... View more
04-09-2013
11:27 AM
|
1
|
0
|
1778
|
|
POST
|
Hi, I downloaded the Basic Viewer template and it is referencing a file called "templateConfig.js" that does not exist in the main folder or any subfolders. The reference in the index.html file is: <script type="text/javascript" src="../../templateConfig.js"></script> What is this file for and why is it not included in the download? Can I just comment it out? Thanks, Joan
... View more
04-09-2013
09:33 AM
|
0
|
2
|
841
|
|
POST
|
What's the easiest way to print the contents of an InfoWindow or Popup? I would think that ESRI would add a "print" link as an option (similar to the "Zoom to" link that's provided in the Popup). Am I missing something easy or do I have to code this myself somehow? Thanks!
... View more
04-04-2013
06:54 AM
|
2
|
5
|
8085
|
|
POST
|
My app provides users the ability to draw various shapes on a map. Oddly, when printing the map (using ESRI's print service), the "Extent" shape is not displayed in the printed map. All other shapes are displayed on the printed map as expected. This only occurs in Firefox (I've tried versions 17.0.1 and 19.0). Can anyone explain this behavior or provide a fix? Below is the pertinent html and javascript code. The app itself is here: http://gis.tpcmaps.org/apps/production/pima Thanks, Joan [HTML] <div class="details">Pick a tool to draw on the map.</div> <!-- The drawn graphic will be buffered based on the specified parameters. --> <img class="drawimage" src="images/ce_draw_point.png" alt="Point" title="Point" onclick="g_tb.activate(esri.toolbars.Draw.POINT);map.disableMapNavigation();map.hideZoomSlider();"/> <img class="drawimage" src="images/ce_draw_multipoint.png" alt="MultiPoint" title="MultiPoint" onclick="g_tb.activate(esri.toolbars.Draw.MULTI_POINT);map.disableMapNavigation();map.hideZoomSlider();"/> <br/> <img class="drawimage" src="images/ce_draw_line.png" alt="Line" title="Line" onclick="g_tb.activate(esri.toolbars.Draw.LINE);map.disableMapNavigation();map.hideZoomSlider();"/> <img class="drawimage" src="images/ce_draw_polyline.png" alt="PolyLine" title="PolyLine" onclick="g_tb.activate(esri.toolbars.Draw.POLYLINE);map.disableMapNavigation();map.hideZoomSlider();"/> <img class="drawimage" src="images/ce_draw_freeline.png" alt="Freehand Line" title="Freehand Line" onclick="g_tb.activate(esri.toolbars.Draw.FREEHAND_POLYLINE);map.disableMapNavigation();map.hideZoomSlider();"/> <br/> <img class="drawimage" src="images/ce_draw_rect.png" alt="Rectangle" title="Rectangle" onclick="g_tb.activate(esri.toolbars.Draw.EXTENT);map.disableMapNavigation();map.hideZoomSlider();"/> <img class="drawimage" src="images/ce_draw_poly.png" alt="Polygon" title="Polygon" onclick="g_tb.activate(esri.toolbars.Draw.POLYGON);map.disableMapNavigation();map.hideZoomSlider();"/> <img class="drawimage" src="images/ce_draw_freepoly.png" alt="Freehand Polygon" title="Freehand Polygon" onclick="g_tb.activate(esri.toolbars.Draw.FREEHAND_POLYGON);map.disableMapNavigation();map.hideZoomSlider();"/> <br /><hr/>[/HTML]
function doDrawShapes(geometry) {
console.log("-->inside doDrawShapes");
g_tb.deactivate();
g_drawnGeometry = geometry;
//addToMap(drawnGeometry);
//use the draw shapes symbologies set up in the config section of index.html.
switch (geometry.type) {
case "point":
//var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25]));
//var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color("#723866"), 2), new dojo.Color("#FC0DD8"));
var symbol = new esri.symbol.SimpleMarkerSymbol(pointSymbol);
break;
case "polyline":
//var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 1);
var symbol = new esri.symbol.SimpleLineSymbol(lineSymbol);
break;
case "polygon":
//var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));
var symbol = new esri.symbol.SimpleFillSymbol(fillSymbol);
break;
//Extent is a rectangle.
case "extent":
//var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));
var symbol = new esri.symbol.SimpleFillSymbol(fillSymbol);
break;
case "multipoint":
//var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,0]), 1), new dojo.Color([255,255,0,0.5]));
var symbol = new esri.symbol.SimpleMarkerSymbol(pointSymbol);
break;
}
var graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
//Enable the Buffer Shapes button.
dijit.byId("bufferShapesBtn").setAttribute('disabled', false);
//reenable map navigation.
map.enableMapNavigation();
map.showZoomSlider();
}
... View more
03-07-2013
06:08 AM
|
0
|
0
|
755
|
|
POST
|
Kelly, Thanks so much for the reply and the sample code. I implemented it and it seems to work perfectly. I really appreciate your help as I don't think I ever would have figured it out on my own! Joan
... View more
03-05-2013
05:38 AM
|
0
|
0
|
1471
|
|
POST
|
Hi, I'm encountering an error using the ESRI print task (http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task) that I'm having trouble resolving. My app is here: http://gis.tpcmaps.org/apps/staging/pima The error only occurs after the data grid is dislplayed (e.g., via the app's Find Parcel functionality) and I then try to Print. The apps returns the error: [INDENT](in Firebug): TypeError: cyclic object value ...="'")){_2f3.matchFor=cmf.slice(1,-1);}}_2f2.attrs.push(_2f3);_2f3=null;_2eb=_2ed... (in IE developer tools): SCRIPT5034: Circular reference in value argument not supported PrintTask.js, line 19 character 2208[/INDENT] The relevant code is: function doFindParcel(searchText) {
console.log("-->inside doFindParcel");
//create query task with url to map service.
var queryTask = new esri.tasks.QueryTask(configOptions.parcellayer);
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outSpatialReference = map.spatialReference;
query.outFields = configOptions.parceloutfields;
console.log("searchText: " + searchText);
//set the search text to find parameters
//findParams.searchText = searchText;
searchby = dijit.byId('searchby').value;
searchfor = searchText.trim(); //trim the string in case user puts leading spaces in.
console.log("searchby: " + searchby + ", searchfor: " + searchfor);
//Search for the keyword at the beginning of the field so it will use the indexes.
//If search with the wildcard in the front, it does a complete table scan which is slow.
switch (searchby) {
case "folio":
//query.where = "OBJECTID = 1";
//query.where = "[FOLIO] = '194001.0000'";
//query.where = "[FOLIO] = '" + searchfor + "'";
query.where = "[FOLIO] like '" + searchfor + "%'";
break;
case "owner":
query.where = "[OWNER1] like '" + searchfor + "%'";
break;
case "site_addr":
query.where = "[STR_NAME] like '" + searchfor + "%'";
break;
}
console.log("query where: " + query.where);
//Show the dialog box to containing "searching" message (so user knows app is doing something).
dijit.byId("searchingDialog").show();
queryTask.execute(query, showParcelResults, showParcelError);
}
function showParcelResults(results) {
console.log("-->inside showParcelResults");
//resultcount = results.length; //this worked for the FindTask, but not for QueryTask.
//think query task returns result objects but find task returns features?
resultcount = results.features.length;
console.log("# of query result objects passed into function: " + resultcount);
features = results.features;
//Close the 'searching' dialog box.
dijit.byId("searchingDialog").hide();
if (resultcount > 0) {
//console.log("-->inside resultcount loop");
//Open the dialog box to display results in a grid.
showResultsGrid(features);
}
//Alert user in case parcel is not found, 9/11/12 jms.
else {
dialogAlert("Find Parcel", searchby + ": " + searchfor + " was not found.");
}
}
function showParcelError(error) {
//Close the 'searching' dialog box.
dijit.byId("searchingDialog").hide();
console.log("Find Parcel", "Error in 'Find Parcel': " + error);
dialogAlert("Find Parcel", "Error in 'Find Parcel': " + error);
}
//Zoom to the parcel when the user clicks a row
function onRowClickHandler(evt){
console.log("-->inside onRowClickHandler");
var clickedTaxLotId = grid.getItem(evt.rowIndex).FOLIO;
var selectedTaxLot;
var symbol = new esri.symbol.SimpleFillSymbol(highlightfillSymbol);
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.FOLIO === clickedTaxLotId){
//Setting the symbology here sets it for only the feature clicked on.
graphic.setSymbol(symbol);
selectedTaxLot = graphic;
return;
}
});
var taxLotExtent = selectedTaxLot.geometry.getExtent();
map.setExtent(taxLotExtent);
}
function showResultsGrid(features) {
//This function works with an array of result that the task returns
console.log("-->inside showResultsGrid");
console.log("# of features passed into function: " + features.length);
var resultcount = features.length;
//Open the dialog box to display results in a grid.
dijit.byId("parcelresultsDialog").show();
//Display number of results in the dialog box header.
dojo.byId('rowcountdisplay').innerHTML=resultcount+" parcels.<br/>"+ configOptions.selectparcelnote + configOptions.maxrecordcount + ".";
//map.graphics.clear();
//clearAllGraphicsLayers();
//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]));
var symbol = new esri.symbol.SimpleFillSymbol(resultfillSymbol);
//create array of attributes and add graphic to map.
items = dojo.map(features, function(feature){
//console.log("-->inside create array of attributes");
//var graphic = result.feature;
var graphic = feature;
//Setting the symbology here sets it for all features in results.
graphic.setSymbol(symbol);
map.graphics.add(graphic);
//console.log("after adding graphic");
return feature.attributes;
});
//Create data object to be used in store
var data = {
identifier: "FOLIO", //This field needs to have unique values
label: "FOLIO", //Name field for display. Not pertinent to a grid but may be used elsewhere.
items: items
};
//Create data store and bind to grid.
var store = new dojo.data.ItemFileReadStore({
data: data
});
//Grid used in the results pop-up dialog.
grid = dijit.byId('grid');
grid.setStore(store);
//Grid used for exporting the data (containing additional fields) to a csv file.
var gridexport = dijit.byId('gridexport');
gridexport.setStore(store);
} I have no idea what the problem is or how to debug this. Can anyone assist or offer suggestions? Thanks in advance, Joan
... View more
02-28-2013
06:55 AM
|
0
|
6
|
5314
|
|
POST
|
I have a pop-up configured that contains a link to an outside url. This opens the url correctly in a new browser window. Is there a way to have it open in the same browser window instead? I don't see a setting to specify a "target" window. Am I missing something? Thanks, Joan
... View more
02-07-2013
05:44 AM
|
0
|
1
|
600
|
|
POST
|
I am testing some code using ESRI's printtask: "http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task", using their default templates. I have omitted the "legendLayers" layout option because I want the legend to show all visible layers. Seems like the Print dijit: ??? only prints the legend of dynamic layers (not tiled)? ??? won't print it if it is too large for a single page? Is this expected behavior or am I missing a setting or something? Thanks, Joan
... View more
12-12-2012
09:15 AM
|
0
|
1
|
656
|
|
POST
|
I need the same capability. The person that creates the feature in the feature class is different than those who maintain the feature attributes. I was hoping to create some kind of form that my attribute editors can access for editing purposes. They don't need the map, they'll query by unique id to populate the editing form.
... View more
12-12-2012
08:50 AM
|
0
|
0
|
1397
|
|
POST
|
Kelly, After looking at your code I see where I went wrong when trying to access the feature set that was passed in. To summarize, what is getting passed in is an object and you have to get the value of the object (in this case a feature set) before you can access the features in the feature set. //My line:
var resultFeatures = results.features;
//Your line:
var resultFeatures = results.value; I appreciate you taking the time to clear this up for me. Many thanks, Joan
... View more
06-28-2012
05:34 AM
|
0
|
0
|
865
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 02-12-2024 07:28 PM | |
| 2 | 04-04-2013 06:54 AM | |
| 1 | 04-09-2013 11:27 AM | |
| 2 | 12-03-2014 08:04 AM | |
| 1 | 05-09-2013 12:45 PM |
| Online Status |
Offline
|
| Date Last Visited |
02-13-2024
03:46 AM
|