POST
|
Hi Does anyone here use dojo.query? Im trying to target my tables with even odd styling but i cant get it to work. I am going to look at building it into a function - currently when the button is clicked the following occur's: on(dom.byId("exe_CPO_data"), "click", exe_CPO_data); Could i run two functions on the div click event with the following: function styleTable() {
dojo.query("#info table tr:nth-child(odd)").addClass("odd");
dojo.query("#info table tr:nth-child(even)").addClass("even")
} Is there a easier way to target the table styling constantly so each time the table is populated it updated the styling as i have 4 buttons doing a querytask each time. thanks Andy
... View more
11-17-2013
08:23 AM
|
0
|
4
|
719
|
POST
|
Hi Just thought i would add in here. I have not worked with the geolocation service since the old syntax so only have some examples of how i got it to work on a BNG projection (27700) Once i got the lat lon i then pushed it through our geometry service // use this if basemap is WGS84 --- var pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(location.coords.longitude, location.coords.latitude));
//otherwise, use this stuff below - basically we make a new point with the geolocated coordinates and reproject it, but to do so, you make the point
//first and specify it's originating spatial reference so then you can reproject it to your own wkid
function zoomToLocation(location) {
var pt = new esri.geometry.Point(location.coords.longitude, location.coords.latitude, new esri.SpatialReference({
wkid: 4236
}
)); //don't forget to specify the originating wkid (in this case from the GPS/Geolocation)
var outSR = new esri.SpatialReference({
wkid: 27700
});
gsvc.project([pt], outSR, function (projectedPoints) {
pt = projectedPoints[0];
map.centerAndZoom(pt, 2);
//add graphic at current location - if graphic exists just move it
if (!graphic) {
addGraphic(pt);
} else { //move the graphic if it already exists
graphic.setGeometry(pt);
}
map.centerAt(pt);
//console.log(pt);
})
}
}; Hope this helps put you in the right direction.
... View more
11-11-2013
10:19 PM
|
0
|
0
|
480
|
POST
|
How about your own github repo full of samples or jsfiddle full of samples with a basic front end for people? As you progress and if the content is interesting, more and more people will know it etc. I have a list of good links i always check out before attempting anything for help etc, if you have some dam decient samples people will soon start having a look. Adding it in the forum in your signature or even just posting in here when you have created something new like nilu't toc and people soon notice. good luck, im interested
... View more
10-31-2013
01:58 AM
|
0
|
0
|
893
|
POST
|
ESRI is moving the core dojo towards AMD following dojo's move towards it earlier. https://developers.arcgis.com/en/javascript/jshelp/inside_dojo_amd.html Legacy syntax is still supported with dojo but its best to get onboard with AMD as it will be the future.
... View more
09-25-2013
05:19 AM
|
0
|
0
|
438
|
POST
|
I got this working in 3.5, still need to move it over to AMD and 3.6 as im having issues with it on that, not spend anytime though to really look into it. //Create basemap layers - manual list that can be edited
function createBasemapGallery() {
//Manually create a list of basemaps to display
var basemaps = [];
var caBackground_GreyscaleLayer = new esri.dijit.BasemapLayer({
url: "http://example/ArcGIS/rest/services/CABackground_Greyscale/MapServer"
});
var caBackground_GreyscaleBasemap = new esri.dijit.Basemap({
layers: [caBackground_GreyscaleLayer],
title: "Greyscale"
});
basemaps.push(caBackground_GreyscaleBasemap);
var caBackgroundLayer = new esri.dijit.BasemapLayer({
url: "http://example/ArcGIS/rest/services/CABackground/MapServer"
});
var caBackgroundBasemap = new esri.dijit.Basemap({
layers: [caBackgroundLayer],
title: "Colour"
});
basemaps.push(caBackgroundBasemap);
var caAerial = new esri.dijit.Basemap({
layers: [new esri.dijit.BasemapLayer({
url: "http://example/ArcGIS/rest/services/CAAerial/MapServer"
})],
id: "CAAerial",
title: "Aerial"
});
basemaps.push(caAerial);
basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: false,
basemaps: basemaps,
map: map
});
//BasemapGallery.startup isn't needed because we aren't using the default basemap, instead
//we are going to create a custom user interface to display the basemaps, in this case a menu.
dojo.forEach(basemapGallery.basemaps, function (basemap) {
//Add a menu item for each basemap, when the menu items are selected
dijit.byId("galleryMenu")
.addChild(new dijit.MenuItem({
label: basemap.title,
onClick: dojo.hitch(this, function () {
this.basemapGallery.select(basemap.id);
})
}));
});
} the HTML <div id="basemapswitcher" region="center">
<button id="dropdownButton" label="Basemaps" dojoType="dijit.form.DropDownButton">
<div dojoType="dijit.Menu" id="galleryMenu">
<!--The menu items are dynamically created using the basemap gallery layers-->
</div>
</button>
</div> You will need the dojo.require for the dojo bits including the menu etc
... View more
09-06-2013
06:31 AM
|
0
|
0
|
344
|
POST
|
you could use something like js beautify to deminify it - http://jsbeautifier.org/ Might not be 100% correct but would make it relatively readable copy and paste the minified code in and press control + enter. Hope that helps
... View more
09-03-2013
12:44 AM
|
0
|
0
|
130
|
POST
|
Yes, the featurelayer recreates the data in the browser, esentially doing a call to the rest endpoint to get the data you need and in turn instead of loading ''images'' from a normal dynamic service it loads data (in json normally) into the browser which gets stored in memory. How much data is being asked of the feature layer? Do you use firebug to see the request going out to the service and the wait for the response? Do you get any console errors?
... View more
09-03-2013
12:39 AM
|
0
|
0
|
197
|
POST
|
Something like this should work.... <serverUrl url="http://sampleserver2.arcgisonline.com/arcgis/rest/services/"
matchAll="true"
token="jijdfihjd023r33yr837r37"></serverUrl>
Ensure you have set up your proxy page correctly and use the following in your application/code: esri.config.defaults.io.proxyUrl = "your_location_to_proxy_page/proxy.ashx";
esri.config.defaults.io.alwaysUseProxy = "true";
... View more
07-01-2013
05:42 AM
|
0
|
0
|
401
|
POST
|
Hi This might help as im doing something similar by activating only the layers i want from a url paramater ie layers=1,2,3,4,5. Its different from your requirements but might help with trying to pass the layer id's yu want to the service. Firstly i setup my dynamic service with a variable - lbsr in this case. lbsr = new esri.layers.ArcGISDynamicMapServiceLayer("http://sccw08ags/ArcGIS/rest/services/APILBSR/MapServer", {
"opacity": 0.7
});
then i see if the layers url parameter is there, the xlgsl code is just a case loop where i have hardcoded lgslids to layer id's but this can be dynamic - // Do we have an xlgsl code in the url?
if (urlObject.query.lgsl) {
var lklgsl = urlObject.query.lgsl;
layers = matchLgsl(lklgsl);
console.log("lgsl code:", lklgsl);
}
//set the visable layers that where passed in the url specified by the lgsl code and if it has matched the matchLgsl function
lbsr.setVisibleLayers(layers);
console.log("Layer ID's being drawn", layers);
} then all i do is pass the layers var as a parameter to my identify function - //pass the layers var to the setUp function to query the data
setUpIdentify(layers); function setUpIdentify(layers) {
//when user clicks on map, call doIndentify()
//map.graphics.clear();
dojo.connect(map, "onClick", doIdentify);
console.log("Setting up identify");
identifyTask = new esri.tasks.IdentifyTask("http://sccw08ags/ArcGIS/rest/services/APILBSR/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
//identifyParams.spatialReference = new esri.SpatialReference({ wkid: 27700});
identifyParams.tolerance = 5;
identifyParams.returnGeometry = true;
identifyParams.layerIds = layers;
... View more
01-29-2013
05:53 AM
|
0
|
0
|
229
|
POST
|
We have been using refresh since 2.8, i have to be honest though and say i have no idea (or cannot remember) how i stumbled across it. function refreshTimer()
{
setInterval(function(){
dojo.forEach(electionLayers, function(layer){
layer.refresh()
});
}, 30000);
} We have a call to refresh the dymanic service looking at SDE data, seems to work fine so far in all browsers.
... View more
01-17-2013
06:22 AM
|
0
|
0
|
457
|
POST
|
there is a Widget here: http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/docs/toc/examples.html This widget is recommended. I am using it in an app that we are designing currently for internal requirements (or i would give you a link to check how it works )but the link provided by jsn should get anyone going with a well presented common TOC. Awsome work from the developer. [ATTACH=CONFIG]20446[/ATTACH]
... View more
01-04-2013
06:30 AM
|
0
|
0
|
405
|
POST
|
Hi What are you trying to achieve? Are you trying to create a dojo accordion? Try using dojo.require("dijit.layout.AccordionContainer"); Heres an example - http://help.arcgis.com/en/webapi/javascript/arcgis/samples/widget_legendvisible/index.html
... View more
11-28-2012
04:27 AM
|
0
|
0
|
112
|
POST
|
Hi Derek Yes, i was looking at seeing if there was any events to hook onto during the esri request to update the status of the div i have the output going to i have however for this instance just used the esri.hide and esri.show calls and this seems to work (but my code loops through alot of different functions depending on the results from the json response) so i have multiple esri calls through the code. It would be easier to hook onto a few main events - i was thinking for my requirements, an onSubmit and onComplete etc, that would make it easier for me however more generic calls would be sufficient as we do not want to overdo the events available, just to ensure end users know that things are progressing etc. Thanks for the consideration, thanks
... View more
11-19-2012
06:57 AM
|
0
|
0
|
184
|
POST
|
Hi Trying to track any info about events as i would like to add a loading gif while the call is being run... Any ideas? I cant find anything regarding events and esri.request..might not be possible but thought i would ask before doing something more complicated. thanks
... View more
11-19-2012
04:28 AM
|
0
|
2
|
650
|
POST
|
cooke its probably best to start your own thread however i have had a look and your code is missing some javascript formatting, the most obvious is the curly bracket on the if statement is not closed. Get firefox and a add on called firebug, this will help with general formatting issues etc... Anyway, this is how i do mine, i run it through my if loop to check for each one: var urlObject = esri.urlToObject(document.location.href);
// Set our default position, zoom level and layerid's
x = 349299;
y = 313074;
zoomLevel = 0;
// Do we have a qeury string on the URL?
if (urlObject.query) {
// Do we have a coords parameter?
if (urlObject.query.coords) {
var coords = urlObject.query.coords.split(',');
// We have an x and a y right?
if (coords.length == 2) {
x = parseFloat(coords[0]);
y = parseFloat(coords[1]);
console.log("x coord passed to map: ", x);
console.log("y coord passed to map: ", y);
}
}
// Let's check for a zoomlevel
if (urlObject.query.zoomLevel) {
var zoomLevel = parseInt(urlObject.query.zoomLevel);
console.log("Zoomlevel passed to map: ", zoomLevel);
}
//Let's check if any layers are specified
/*if (urlObject.query.layers) {
//layers = parseInt(urlObject.query.layers);
layers = urlObject.query.layers.split(',');
console.log("layer ID's passed to map: ", layers);
}*/
if (urlObject.query.lgsl) {
var lklgsl = urlObject.query.lgsl;
layers = matchLgsl(lklgsl);
console.log("lgsl code:", lklgsl);
}
//set the visable layers that where passed in the url
lbsr.setVisibleLayers(layers);
console.log("Layer ID's being drawn", layers);
}
// Position our mapto the x and y provided in the url
var point = new esri.geometry.Point([x, y], new esri.SpatialReference({
wkid: 27700
}));
//var point = esri.geometry.Point(new esri.geometry.Point(x, y));
console.log("Zooming to location...", point, zoomLevel);
map.centerAndZoom(point, zoomLevel);
console.log("Zoom complete");
// Highlight the item on our map
if (!graphic) {
addGraphic(point);
} else {
graphic.setGeometry(point);
}; I can then call my map like so: http://servername/site/urlparameters.html?coords=351406,329248&zoomLevel=8&layers=0,1,2,3&lgsl=1306 I have a default x,y,zoomlevel that if they are not specified in the url, it zooms to those hard coded values. Im a bit unsure how it works with your template but dont see why there should be an issue, just ensure you calling ''map'' correctly as you dont seem to specify a map but rather a template and i dont have any experience with that method.
... View more
11-19-2012
01:37 AM
|
0
|
0
|
1452
|
Title | Kudos | Posted |
---|---|---|
1 | 10-24-2012 06:26 AM | |
1 | 07-09-2017 08:13 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|