|
POST
|
No worries. Let's try this instead: on(dom.byId("sel_county"), "change", function () {
extractMethod = "extractByCounty";
console.log("You are selecting a county!");
});
on(dom.byId("sel_unit"), "change", function () {
extractMethod = "extractByUnit";
console.log("You are selecting a unit!");
});
... View more
05-28-2014
01:24 PM
|
0
|
0
|
3035
|
|
POST
|
Ok, that's helpful. The event listener I gave you isn't firing. Alter the code slightly as shown below: dom.byId("sel_county").on("change", function () {
extractMethod = "extractByCounty";
console.log("You are selecting a county!");
});
dom.byId("sel_unit").on("change", function () {
extractMethod = "extractByUnit";
console.log("You are selecting a unit!");
});
... View more
05-28-2014
12:56 PM
|
0
|
0
|
3035
|
|
POST
|
Ah. so I remove the following code before the query? var unit = document.getElementById("sel_unit").value No- leave that. Otherwise, you won't know what Unit the user has selected. The code I posted for the listener is ONLY for keeping track of what the user does (they drew a polygon so extract by polygon, they selected a unit from the combo box so extract by unit, etc). Hopefully you see that the variable extractMethod is constantly populated and overwritten every time the user does one of those three things- draw a shape, select an item in the County combo box, or select a Unit in the Unit combo box. In theory, the Extract button (and the switch statement) will look at what the most recent value for extractMethod is. You could do all three options and if you last drew a polygon, that's what the switch statement should act on. Your follow up post makes me wonder if the change event is "change" or "onChange". Here's a simple test to see whether or not the listener is properly set up. Add the following line of code inside the function: registry.byId("sel_county").on("change", function () {
extractMethod = "extractByCounty";
console.log("You are selecting a county!");
});
registry.byId("sel_unit").on("change", function () {
extractMethod = "extractByUnit";
console.log("You are selecting a unit!");
}); Watch the console when you pick an item from either combo box. You should see the statement show up once you select an item. If it's not, then there's something off with my event code, either I have the wrong event name or something else. Try this and post what you observe.
... View more
05-28-2014
11:20 AM
|
0
|
0
|
3035
|
|
POST
|
Alex- Now that I see your code in the JSBin, I'm hoping I can clear up the confusion about my initial approach about using the Switch statement. First, the initial variable declaration for extractMethod should be moved way up in your code. Add it to your series of global variables immediately before your Require() line: var gp, map, toc, dynaLayer1, query, queryTask;
var symbol, infoTemplate, extractMethod;
var AOI, graphic, clipFeatureSet, clipFeature; Once you move it, delete those three lines that you currently have. Next, modify your selectionToolbar "draw-end" function like this: selectionToolbar.on("draw-end", function (e) {
selectionToolbar.deactivate();
var symbol3 = new SimpleFillSymbol(
"solid",
new SimpleLineSymbol("dash", new Color([255, 0, 0]), 2),
new Color([255, 255, 0, 0.25])
);
var graphic = new Graphic(e.geometry, symbol3);
map.graphics.add(graphic);
extractMethod = "extractByPoly";
}); From what I can tell, you are missing event listeners for your two combo boxes (County and Unit) so you need to create them: registry.byId("sel_county").on("change", function () {
extractMethod = "extractByCounty";
});
registry.byId("sel_unit").on("change", function () {
extractMethod = "extractByUnit";
}); I think this will finally set values for extractMethod such that the switch statement will then do what it's supposed to do. Steve
... View more
05-28-2014
10:02 AM
|
0
|
0
|
5121
|
|
POST
|
Ok, well, here's another option on the JS side of things you can try while your application loads. You basically tell the titlePane to close programatically. Here's my same example as before but using this JS method instead of specifying it on the HTML side of things: [HTML]<!DOCTYPE html> <html > <head> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"/> <script>dojoConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script> <script> dojo.require("dijit.TitlePane"); function init() { dijit.byId("tp2").set("open",false); }; dojo.addOnLoad(init); </script> </head> <body class="claro"> <div id="tp2" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'I\'m a TitlePane Too'"> Click arrow to close me. </div> </body> </html>[/HTML] Now, the app you inherited may be structured a little different but the key line is that one line of code in my example's init function.
... View more
05-27-2014
11:50 AM
|
0
|
0
|
3622
|
|
POST
|
ok, gotcha. So you do have a bunch of code already but don't understand it all. I would search through your HTML code for the text "dijit.TitlePane". It's within THAT html code that you would add the data-dojo-props like I originally suggested. Here's a VERY basic example, written in legacy: [HTML]<!DOCTYPE html> <html > <head> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"/> <script>dojoConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script> <script> dojo.require("dijit.TitlePane"); </script> </head> <body class="claro"> <div id="tp2" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'I\'m a TitlePane Too', open: false"> Click arrow to close me. </div> </body> </html>[/HTML] A borderContainer is a higher level object. It's used like a "box" in which you add other objects. I can't be 100% sure without seeing that other code but I suspect your titlePane with be located down a level or two from a borderContainer.
... View more
05-27-2014
10:47 AM
|
0
|
0
|
1060
|
|
POST
|
Are you literally starting from scratch? You asked about legacy code so I thought you already had some code / HTML written.
... View more
05-27-2014
10:23 AM
|
0
|
0
|
2562
|
|
POST
|
Can you post your HTML code? That would be the best way to help.
... View more
05-27-2014
10:01 AM
|
0
|
0
|
2562
|
|
POST
|
The *ONE* time I assume someone is using AMD... LOL. 😄 Actually, not much different. Here's an HTML line for a contentPane from one of my legacy projects: [HTML]<div id="dataLayerSection" dojoType="dijit.layout.ContentPane" title="Data Layers" data-dojo-props="label:'Click to Expand'" selected="true">[/HTML] So basically the forward slashes become periods.
... View more
05-27-2014
07:55 AM
|
0
|
0
|
2562
|
|
POST
|
Wouldn't use just set one of it's properties with data-dojo-props on the HTML side of things like this: [HTML]<div data-dojo-type="dijit/TitlePane" data-dojo-props="open: false"></div>[/HTML] Steve
... View more
05-27-2014
06:53 AM
|
0
|
0
|
2562
|
|
POST
|
If you have two dropdown combo boxes, they would both have their own change event and that's how you would differentiate between County and unit by populating the global variable like I described in my original reply. No matter which of the three options the user chooses, the extractMethod variable stores a value which you then retrieve during the click event for your Extract button to learn which method the user wants. The switch conditional statement is used to chose a path of action based on multiple options. If you've programmed in VB or VBA, it's a lot like the SELECT CASE statement. Steve
... View more
05-20-2014
07:12 PM
|
0
|
0
|
1985
|
|
POST
|
I think one way would be using a global variable (something like "var extractMethod;") that gets populated at the conclusion of all three "methods". So, for example, at the conclusion of the user's draw event, code something like: extractMethod = "extractByPoly"; In the dropdown's update method for your county list, code something like: extractMethod = "extractByCounty"; ...and finally, at the end of the dropdown's update method for your unit's info, code something like: extractMethod = "extractByUnit"; Now, in the click event for your "Extract" button, use a switch conditional to then determine what to do: switch (extractMethod )
{
case "extractByPoly":
someSubRoutine();
break;
case "extractByCounty":
executeQueryTask(countyName);
break;
default:
executeQueryTask(unitName);
break;
} Steve
... View more
05-20-2014
03:12 PM
|
0
|
0
|
1985
|
|
POST
|
You are missing BorderContainer and ContentPane from your list passed to the function. Check that first. Steve
... View more
05-09-2014
02:14 PM
|
1
|
0
|
2645
|
|
POST
|
Very minor but- a space is missing in the tooltips for the zoom in & zoom out icons in the upper left. No tooltip exists for the email icon. I'd make the "Manatee County" and "Public Safety" text in the upper right clickable links No idea what the colored grid is that's part of the Public Safety layer load. Doesn't appear to be in the legend? Congratulations on the achievement, though! Steve
... View more
05-07-2014
01:59 PM
|
0
|
0
|
2470
|
|
POST
|
Unfortunately, my organization has blocked GitHub for fear of malicious Javascript but I have done what you want in my own webmaps. Jquery provides infinite opportunities for displaying "modal" dialogs such as splash screens so that is the path I've chosen for my own work. Specifically, I have used Freeow! and I think it's relatively painless to set up and use. All of these modal dialogs usually rely on a hidden DIV element in your HTML and will display it at the time you want it to appear. Freeow is no different. Simply create an empty DIV element (give it an ID so that it can be referenced). On the javascript side, you invoke your splash screen at the end of your initialization routine or include it in an event driven function. I invoke my splash screen in dojo.ready(). I've had to tweak Freeow slightly to get it the way I want in terms of screen location and styling but that's pretty much just tweaking the CSS file that comes with it. I've attached a screen shot of my splash screen. It's a little fancy since I use browser cookies to either display or avoid displaying the splash screen but the core functionality of the splash screen is straight from Freeow. Steve
... View more
05-07-2014
12:11 PM
|
0
|
0
|
2894
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 2 | 05-21-2026 01:51 PM | |
| 1 | 03-12-2026 01:43 PM | |
| 1 | 03-12-2026 08:41 AM |