|
POST
|
Jeff is correct! Look for multiple instances of the parser or incorrectly formatted HTML if you are using BorderContainers and ContentPanes. Some users end up having the parser run twice after migrating from an older version of the API to a newer one. For example, having both of the following in your application will throw a parser error:
<script type="text/javascript" src="dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>
require(["dojo/parser", "dojo/ready"], function(parser, ready){
ready(function(){
parser.parse();
});
});
... View more
10-01-2013
06:49 AM
|
0
|
0
|
2447
|
|
POST
|
At:
var data = array.map(results.features, function (feature) {
return {
"OBJECTID": feature.attributes[window.outFields[0]],
"NAME": feature.attributes[window.outFields[1]],
"OWNER": feature.attributes[window.outFields[2]],
"COUNTY": feature.attributes[window.outFields[3]],
"LATITUDE": feature.attributes[window.outFields[4]],
"LONGITUDE": feature.attributes[window.outFields[5]]
}
});
Is your data variable successfully populated? Have you considering using a store since you are using an OnDemandGrid? Essentially, you invoke and pass along the Memory module but don't use it. Off topic: Is there a specific reason you are storing things globally using the window object? This is fine for debugging but generally not encouraged in a production environment.
... View more
09-30-2013
02:30 PM
|
0
|
0
|
2775
|
|
POST
|
Sounds like you're running the parser twice. Double check your code to make sure you aren't invoking the parser multiple times.
... View more
09-30-2013
01:44 PM
|
0
|
0
|
2447
|
|
POST
|
Can you post your require block as well? I see you are using renderArray instead of a store; are you refreshing the grid after? Are there any error messages? If no error messages, have you tried a 'Try/Catch' block around the suspected problem?
... View more
09-30-2013
01:40 PM
|
0
|
0
|
2775
|
|
POST
|
Your require block is wrong: require(["dojo/_base/connect", "dojo/parser", "agsjs/dijit/TOC", "dijit/layout/BorderContainer", "dijit/layout/ContentPane",
"esri/map", "esri/dijit/Scalebar", "esri/dijit/OverviewMap", "esri/layers/FeatureLayer", "dojo/fx", "dojo/domReady!"],
function(Scalebar, OverviewMap, connect, parser, TOC) {.... This is what it should be: require([
"dojo/_base/connect",
"dojo/parser",
"agsjs/dijit/TOC",
"esri/map",
"esri/dijit/Scalebar",
"esri/dijit/OverviewMap",
"esri/layers/FeatureLayer",
"dojo/fx",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojo/domReady!"
], function(
connect,
parser,
TOC,
Map,
Scalebar,
OverviewMap,
FeatureLayer,
fx
) {.... Make sure you call your modules in the correct order. They need to be declared in the same order that they are invoked in the require block. This DOJO tutorial explains the whys & hows of AMD: https://dojotoolkit.org/documentation/tutorials/1.9/modern_dojo/
... View more
09-30-2013
01:29 PM
|
0
|
0
|
3082
|
|
POST
|
Ran into this exact issue when writing an application a while back. Per suggestion, this is a function I used (I did not write this).
function calcGraphicsExtent(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++) {
ext = (g = graphicsArray.geometry).getExtent();
if (ext === null) {
ext = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
fullExt = fullExt.union(ext);
}
return fullExt;
}
Not that you needed help; just wanted to share my solution as it is relevant to this discussion.
... View more
09-30-2013
01:20 PM
|
0
|
0
|
2861
|
|
POST
|
Your links are broken but I noticed you've already opened a thread on this topic in another area: http://forums.arcgis.com/threads/93446-Where-si-the-Map-Notes-web-application Fixed Links: http://www.arcgis.com/apps/OnePane/basicviewer/index.html?appid=74ff72a794394ed68de9195c2ddf94a6 http://www.arcgis.com/home/item.html?id=25db16cfe7b64501a0b7f6d132338620 Unfortunately, I do not know the answer to your question.
... View more
09-26-2013
01:34 PM
|
0
|
0
|
430
|
|
POST
|
Hey Steve, I did a quick search and found something under the archives. Using lang="en" can break apps that use when using layout dijits and data-dojo-config(or dojoConfig) locale or extraLocale is not set. The recommended fix is to set locale or extraLocale on data-dojo-config or remove the lang="en" attribute. The specific error seen when this is an issue is "dojo/parser::parse() error TypeError" in Chrome and "TypeError: _72f(...) is undefined" in Firefox. More information is available in the Dojo bug tracker: http://trac.dojotoolkit.org/ticket/15630#comment:7 http://trac.dojotoolkit.org/ticket/15768#comment:6 See if that helps at all. If not, I'll take another look. Also, if you haven't seen this, it may be worth a look: https://developers.arcgis.com/en/javascript/jshelp/migration_30.html
... View more
09-26-2013
01:29 PM
|
2
|
1
|
4033
|
|
POST
|
It seems you changed this code: var data = array.map(results.features, function (feature) {
return {
// property names used here match those used when creating the dgrid
"id": feature.attributes[outFields[0]],
"bankName": feature.attribute[outFields[1]],
"bankAddres": feature.attributes[outFields[2]],
"manager": feature.attributes[outFields[3]],
"time": feature.attributes[outFields[4]]
}
}); You wrote 'attribute' instead of 'attributes.' Change that and it works. If you are having trouble with errors like these, you could use a try/catch block to more easily identify the problem. If you have any additional issues, it might be better to open a new thread.
... View more
09-26-2013
01:07 PM
|
0
|
0
|
1997
|
|
POST
|
Just looked; it seems you've changed something else. I tested it and it works with your original code.
... View more
09-26-2013
12:34 PM
|
0
|
0
|
1997
|
|
POST
|
I would suggest opening up your browser console and troubleshooting the easier errors first. Example: I see a parser error in the console as follows: dojo/parser::parse() error
Error: ReferenceError: bottom is not defined in data-dojo-props='region: bottom' Refers to this line: <div id="outGrid" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: bottom"> You need to add single quotes around the word bottom, just like you have for the other content pane region properties. <div id="outGrid" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'"> There are further issues after that change... The parser is unnecessarily being called multiple times, causing expected parser errors. You are still using a dojox datagrid but haven't included that module in your require. I noticed you are loading the dgrid "OnDemandGrid" module but aren't actually doing anything with it. Also, you aren't setting an idProperty on your store (basically, assign a unique ID). I took a few minutes to rewrite your application to use a dgrid to display the results of your query task. I *strongly* suggest stepping back from this application and hammering out the functionality before doing anything with styling, css or images. Try writing several smaller applications that each focus on a specific functionality, and then combine and integrate overall functionality between those smaller apps. This should keep your code much more clean and manageable over a longer period. Rewritten application below: <title>
Text Search
</title>
<script src="http://js.arcgis.com/3.6/">
</script>
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/dojo/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/dojo/dojox/grid/resources/tundraGrid.css">
<style>
html, body, #grid {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
width:100%
}
</style>
<script>
require([
"dojo/_base/declare",
"dojo/store/Memory",
"dgrid/OnDemandGrid",
"dojo/parser",
"dojo/ready",
"esri/tasks/query",
"esri/tasks/QueryTask",
"dojo/dom",
"dojo/on",
"dojo/_base/array"
], function(declare, Memory, OnDemandGrid, parser, ready, Query, QueryTask, dom, on, array) {
var myQuery, myQueryTask;
var StandardGrid = declare([OnDemandGrid]);
var grid = new StandardGrid({
bufferRows: 50,
columns: {
apino: "API No",
otherid: "State Permit No",
wellname: "Operator",
county: "County",
twp: "Township",
rge: "Range",
section_: "Section",
drillertotaldepth: "Depth (ft)",
formationtd: "Formation at Depth",
folderField: "Well Folder",
logField: "Scanned Well Log",
lasField: "LAS Data"
}
}, "grid");
ready(function() {
// Make sure all elements are loaded and accessible
parser.parse();
// Run the Query
runQuery();
function runQuery() {
myQuery = new Query();
myQueryTask = new QueryTask("http://services.azgs.az.gov/ArcGIS/rest/services/aasggeothermal/AZWellHeaders/MapServer/0");
myQuery.returnGeometry = false;
myQuery.outFields = ["apino", "otherid", "wellname", "county", "twp", "rge", "section_", "drillertotaldepth", "formationtd", "field", "relatedresource", "welltype"];
myQuery.where = "apino like '%%'" + " OR " + "otherid like '%%'";
myQueryTask.execute(myQuery, updateGrid);
}
function showResults(myFeatures) {
console.log(myFeatures);
var s = "";
for (var i = 0, il = myFeatures.features.length; i < il; i++) {
var featureAttributes = myFeatures.features.attributes;
for (att in featureAttributes) {
s = s + "<strong>" + att + ": </strong>" + featureAttributes[att] + "<br />";
}
}
dojo.byId("info").innerHTML = s;
}
function updateGrid(featureSet) {
console.log("featureSet", featureSet);
var data = [];
array.forEach(featureSet.features, function(entry) {
var logs = [],
las = [],
folders = [],
relatedResource = entry.attributes.relatedresource === null ? "no value" : entry.attributes.relatedresource;
var raw = relatedResource.split("|");
raw.forEach(function(bit) {
var resource = bit.split(", ");
if (resource[0] && resource[1]) {
var url = resource[1].trim();
var name = resource[0].trim();
}
var anchor = "<li><a href='" + url + "' target='_blank'>" + name + "</a></li>";
if (url != null) {
if (url.indexOf(".tif", url.length - 4) !== -1) {
logs.push(anchor);
}
if (url.indexOf(".pdf", url.length - 4) !== -1) {
folders.push(anchor);
}
if (url.indexOf(".las", url.length - 4) !== -1) {
las.push(anchor);
}
}
});
data.push({
objectid: entry.attributes.objectid,
apino: entry.attributes.apino,
otherid: entry.attributes.otherid,
wellname: entry.attributes.wellname,
county: entry.attributes.county,
twp: entry.attributes.twp,
rge: entry.attributes.rge,
section_: entry.attributes.section_,
drillertotaldepth: entry.attributes.drillertotaldepth,
formationtd: entry.attributes.formationtd,
logField: '<ul>' + logs.join(" ") + '</ul>',
lasField: '<ul>' + las.join(" ") + '</ul>',
folderField: '<ul>' + folders.join(" ") + '</ul>'
});
});
var dataForGrid = {
items: data
};
//console.log(data);
var store = new Memory({
data: dataForGrid,
idProperty: "apiNo"
});
grid.setStore(store);
}
});
});
</script>
</head>
<body class="tundra">
<div id="grid" style="margin:0; padding:0;"></div>
</body>
</html> I didn't change your 'updateGrid()' function much, outside of changing the store and adding an idProperty. In my opinion, you still have a lot of changes to make. This is a hardcore developer project and you have your hands full. Hopefully this advice helps.
... View more
09-26-2013
11:28 AM
|
0
|
0
|
2276
|
|
POST
|
Hey Steve, Could you post your code and/or the exact parser error you are receiving? Like you said, many parser issues result from incorrectly formatted HTML but it could be as simple as you invoking the parser at the wrong time.
... View more
09-26-2013
10:27 AM
|
0
|
0
|
4033
|
|
POST
|
Can you post your updated javascript, your css and the specific errors from the console? Or, you can replicate your project in a http://jsfiddle.net/ so we can look at a 'working' version. This will make troubleshooting much easier. Thanks!
... View more
09-26-2013
10:00 AM
|
0
|
0
|
2276
|
|
POST
|
I would try rewriting the HTML section of your application to properly use BorderContainer and ContentPane. With the code as it is now, you will get parser errors. Don't forget to update this thread with your solution, or to mark it as 'answered' to assist future users with the same issue.
... View more
09-26-2013
09:57 AM
|
0
|
0
|
2077
|
|
POST
|
Spent another few minutes on Google, found this: http://stackoverflow.com/questions/17475515/using-requirejs-with-dojo-1-9-1 You need to use the source/SDK version of the Dojo Toolkit. Built copies of AMD modules are not compatible between loaders. Hope this helps.
... View more
09-26-2013
07:20 AM
|
0
|
0
|
2411
|
| 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
|