|
POST
|
One of the things I had to do to get mine to work was to use proxy pages, and then include the serverUrl in it where my printService was being hosted.
... View more
10-28-2013
01:15 PM
|
0
|
0
|
2248
|
|
POST
|
I don't see how Memory knows that NAME exists to serve as the idProperty. If all you have is an array of names, where does it pick out anything called NAME? I have a function that populates a filteriingSelect. Maybe something in this will help you?
function populateResultsHandler(results){
var select = registry.byId("pickSelect");//my filteringSelect dijit
pickList.length = 0;
var numResults = results.featureSet.features.length;
for (var j = 0; j < numResults; j++) {
var pickCode = results.featureSet.features .attributes[pickAttr];
pickList.push({id: pickCode, label: pickCode});
}
pickList.sort(function(item1, item2) {
var label1 = item1.label.toLowerCase(),
label2 = item2.label.toLowerCase();
return (label1 > label2) ? 1 : (label1 < label2) ? -1 : 0;
});
var dataStore = new Memory({data:pickList, idProperty:"id"});
select.set ("searchAttr", "id");
select.set("labelAttr", "id");
select.set("store", dataStore);
}
Here's the HTML
<select id="pickSelect" data-dojo-type="dijit/form/FilteringSelect" placeHolder="Select a township"
data-dojo-props="title:'Find points in selected township/range',maxHeight:200, size: 30, queryExpr:'${0}*', ignoreCase:true">
</select>
... View more
10-28-2013
12:47 PM
|
0
|
0
|
3124
|
|
POST
|
I have found multiple threads about populating a dgrid from results of a query task, but I still can't figure out what is wrong with the way I have my dGrid and Memory created. I have multiple queries getting executed, and each of the query results will be put in a separate Title Pane within a Floating Pane. The title panes are getting created and I see that my Memory is populated, but I must not have this formatted correctly, because when I use it as the store for my dGrid, I get an empty grid. The loop that reads the attribute names to create the columns look right. function queryGeometryResultsHandler_toGrid(results, idx) { //format the data for the data grid var dataList = {}; dataList.data = arrayUtils.map(results.features, function(feature){ return feature.attributes; }); var currentMemory = new Memory({data:dataList.data, idProperty:'OBJECTID'}); var gridcolumns = []; for (attName in dataList.data[0]) { if (attName != "Shape" && attName !== "Shape.area" && attName !== "Shape.len") { var objects = {}; objects.label = attName; objects.field = attName; gridcolumns.push(objects); } } //create a titlePane in the floatingPane for each visible layer var currentLayerId = qTaskNameList[idx];//a list of layers created in query task functions var paneTitle = (currentLayerId.split('_').join(' '))+" ("+results.features.length+")";//formats string to look nice tp = new TitlePane({ id: 'gridPane_'+currentLayerId, title: paneTitle, splitter:true, class:'reportTitlePane'}); registry.byId("reportContainer").addChild(tp); tp.startup(); // Create Grid using structure and data defined above grid = new Grid({id:currentLayerId+'_grid', autoHeight:true, columns:gridcolumns, store:currentMemory} ); //dgrid grid.startup(); if (results.features.length > 0) { tp.set("content", grid); }else { tp.set("content", "No features found"); } } I had this working in non-AMD style, but there I was using ItemFileReadStore and Dojox.Grid.DataGrid, so I know my theory is basically sound, just not the syntax. Here's a link. You have to turn on some layer other than legislative districts, like schools, and then enter a district number to initiate the query. https://ogitest.oa.mo.gov/LEGIS/LegislativeAnalysis/index.html
... View more
10-28-2013
06:19 AM
|
0
|
16
|
5132
|
|
POST
|
I'm talking myself into a circle on which type of grid to use. I'm also confused on what type of data to use with each type of grid. In my reading, it looks like if I create a dGrid, then I should populate my data by creating 'data' and then using something like mygrid.renderArray(data). And if I'm using another type of grid, then I should create a Memory, populate this with the data and then set the store on the grid to it? Or do I have that exactly backwards? I had this working in my non-AMD version with a dojox/DataGrid, but I'm trying to be a little more updated. I have a set of functions that takes the results of series of queries, populates a floatingpane with new titlePanes containing grids that correspond to each layer that is queried. I know my query is running and I can see I have data, but it's not formatted right, so my newly created grids are empty. I have the proper number of title panes in my floating pane and since they have the right titles, which are based on the layer queried and the number of features returned, I feel like the query part is correct. Only the data for the grid isn't right, so it never displays. I am using dgrid/Grid to construct Grid. cleanQueryResults is executed from an all(input).then(executefunction) type set up.
function cleanQueryResults (queryResults) {
var successResults = [];
var featuresFound = 0;
openFloatingPane('floater_report');
//run the destroyrecursive on the children, running it on the reportContainer removes container too.
var reportCon = registry.byId("reportContainer");
var reportChildren = reportCon.getChildren();
if (reportChildren.length > 0) {
arrayUtils.forEach(reportChildren, function(w){
w.destroyRecursive();
})
}
console.log("queryResults.length = " + queryResults.length);
for (i=0;i<queryResults.length;i++) {
try {
var featureSet = queryResults;
featuresFound = featureSet.features.length;
if (featuresFound === 0) {
console.log("No features found in featureSet["+ i + ']');
}
console.log ("process = " + i +", records found = " + featuresFound);
queryGeometryResultsHandler_toGrid(featureSet, i);
} catch (e) {
console.log("Error caught");
console.log(e);
}
}
}
function queryGeometryResultsHandler_toGrid(results, idx) {
//esri.hide(loading);
var resultsLength = results.features.length;
//format the data for the data grid
var featureAttributes = arrayUtils.map(results.features, function(feature){
return feature.attributes;
});
var data = {
identifer: "OBJECTID",
items: featureAttributes
};
var currentStore = new Memory({data:data});
/*
var currentStore = new Memory({
data: data,
idProperty:"OBJECTID"
});
*/
//build an array of field names for the grid structure
var itemNames = [];
var firstFeature = featureAttributes[0];
for (var fieldName in firstFeature) {
itemNames.push(fieldName);
}
// create layout for the grid based on current fields in the featureSet
var currentLayout = [];
var addField;
var grid;
currentQLayer = qTaskList[idx];
//except for objectid or fid, used for the row click function, skip over internal field names
arrayUtils.forEach(itemNames, function (fieldName) {
switch (fieldName) {
case "FID":
addField = { field: fieldName, formatter: makeZoomButton };
currentLayout.push(addField);
break;
/* case "OBJECTID":
addField = { field: fieldName, formatter: makeZoomButton };
currentLayout.push(addField);
break;*/
case "Shape":
break;
case "Shape.area":
break;
case "Shape.len":
break;
default:
addField = {
field: fieldName,
label: fieldName
};
currentLayout.push(addField);
}
});
//create a titlePane in the floatingPane for each visible layer
var currentLayerId = qTaskNameList[idx];//expect this to be in the same number and order as the querytasks
var paneTitle = (currentLayerId.split('_').join(' '))+" ("+resultsLength+")";
tp = new TitlePane({ id: 'gridPane_'+currentLayerId, title: paneTitle, splitter:true, class:'reportTitlePane'});
var reportCon = registry.byId("reportContainer");
reportCon.addChild(tp);
tp.startup();
// Create Grid using structure and data defined above
grid = new Grid({id:currentLayerId+'_grid', columns:currentLayout, autoHeight:true} );
var currentPane = registry.byId('gridPane_'+currentLayerId);
grid.startup();
if (results.features.length > 0) {
currentPane.set("content", grid);
grid.renderArray(data);
// grid.set("store", currentStore);
}else {
currentPane.set("content", "No features found");
}
}
... View more
10-23-2013
01:22 PM
|
0
|
0
|
896
|
|
POST
|
Sure enough, I had renamed my errorHandler function, but forgot to change the queryTask.on event listener queryTask.on('error', populateErrorHandler);
... View more
10-11-2013
01:10 PM
|
0
|
0
|
2269
|
|
POST
|
Thanks for the offer. I have a feeling it's something right in front of me, so I'm going to try a little longer. No sense in embarrassing myself.
... View more
10-11-2013
01:04 PM
|
0
|
0
|
2269
|
|
POST
|
Styling was way easier, the code assist was more robust, you could see exactly what properties and methods were available for any object I created, without having to have another window open constantly reviewing the API reference. If I needed to add an event listener, for instance, I could just specify a function name and if it didn't exist already it would offer to set up some stub code for the new empty function. Since you were developing in an environment where the IDE and the API library were meant to go together, the design environment was much more transparent. Writing this is sounds like my main complaint is not the way it functions for the end user. Maybe I need to search around again for a different IDE. I'm using Aptana because that's how ESRI laid it out in their getting started. Plus it looks somewhat like FLEX in the way the tools at the top are laid out, creating projects etc. I don't like Notepad ++ because what I'm needing is more of a design environment. I did recently get DreamWeaver, maybe I should try that again. I had an older version, but I never got any good at it. As far as the HTML 5 comment - if we could ever get there, my life would be easier. Our default browser is IE 8. When you're working with an org that has tens of thousands of computers, any upgrade is an ordeal
... View more
10-11-2013
12:32 PM
|
0
|
0
|
1645
|
|
POST
|
I tried that first, before I sent this and it wasn't working. I've changed several places in this function to use variables instead, maybe I should be expand to other lines. This might not be the problem at all! Like I said - Friday - brain dead.
... View more
10-11-2013
12:03 PM
|
0
|
0
|
2269
|
|
POST
|
I have about a dozen very well received FLEX sites that are 4-5 years old now. There's no way I'm going to be able to rewrite these in Javascript to be as nice. I can only hope that eventually there will be more JS equivalents to replace the components that were standard in the FLEX libraries.
... View more
10-11-2013
12:01 PM
|
0
|
0
|
1645
|
|
POST
|
I'm sure if it wasn't Friday afternoon, I'd figure this out on my own. I am trying to set up a more generic function to construct and execute a query task. Instead of having my query.where clause be something like selQuery.where = "DISTRICT= '" + myCode + "'"; //myCode coming from a FilteringSelect value I'd like the field name to also be a variable. But I think the syntax for the where clause needs to be in the form of "FIELDNAME" = 'myValue', and I'm not quite sure how to get the quotes properly formatted in the string. Please someone who's brain is still functioning, help me out!
... View more
10-11-2013
11:14 AM
|
0
|
6
|
2777
|
|
POST
|
It sounded like a nightmare to me too, which is why I left it as a mobile friendly web page.
... View more
10-11-2013
11:03 AM
|
0
|
0
|
1645
|
|
POST
|
No good reason to have an app, no. In general, people just want to be able to say "go download our app", or "we have an app for that". I haven't been pressed lately, so I stopped pursuing the 'wrapper to make an app' approach. Mostly I'm holding out for every type of phone so I can properly test on all basic phones on the market. 😄
... View more
10-11-2013
10:59 AM
|
0
|
0
|
1645
|
|
POST
|
I developed in Flex for a few years before the writing on the wall made me switch to Javascript. I never looked at Silverlight because in the ESRI community it always seemed to be in 3rd place among the 3 APIs offered. The only scenario I might go back to FLEX/Flash is for the development of a mobile app, which is supposedly possible, although I've never tried it. Although I have created a mobile friendly web page that works just fine on a phone, I continue to hear "But we want an app, not a web page".
... View more
10-11-2013
10:47 AM
|
0
|
0
|
3700
|
|
POST
|
I'm not seeing that you set a spatialReference. Have you tried adding that?
... View more
10-08-2013
01:47 PM
|
0
|
0
|
1704
|
|
POST
|
I don't know how many people who watch this forum also use the Android SDK. I'd suggest you search for a forum that covers that instead of the Javascript API.
... View more
10-08-2013
01:15 PM
|
0
|
0
|
2002
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2017 02:38 PM | |
| 2 | 03-18-2022 10:14 AM | |
| 2 | 02-18-2016 06:28 AM | |
| 1 | 03-18-2024 07:29 AM | |
| 4 | 08-02-2023 06:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-25-2025
01:56 PM
|