|
POST
|
I have mobile project based on Dojo which has two dojox/mobile/Views, one that is a list and one that is a map. The list contains several features in it and when the user clicks on the Map It button for that item, they're taken to a map where that feature is located. At the top of the View for the map, I have a back button, which will take them to the original View containing the list.
<div id="backButton" data-dojo-type="dojox/mobile/ToolBarButton" style="float: right;" moveTo="mainView">Back</div>
I'd really like to be able to retain the position in the list where the user was before they viewed the map, but moving to mainView resets itself to the top of the list again. Is there any way to scroll back to the item they were on previously? http://jsfiddle.net/schlot/7t8Lu/3/
... View more
03-07-2014
11:48 AM
|
0
|
0
|
762
|
|
POST
|
I think I found a clue of what is happening. My opening view isn't the map, it's a couple of choices for either viewing the map or a list. Apparently when you do this, the default map ends up created as 400 x 400 because the div it's in isn't initialized yet. I added some code in my map.on ('load') to set the height of my mapDiv to be 100% and it is now filling the screen. I'm not sure I have it set to the right listener, but at least it isn't cropped!
... View more
03-06-2014
07:35 AM
|
0
|
0
|
616
|
|
POST
|
Update - I removed all the references to map.resize and map.reposition and commented out the function that was supposed to adjust the the map height. I am no longer seeing the map disappear after a few seconds, but the size of the map is still set to 400 X 400. The map container it's in fills the screen, its only mapDiv that's cropped. I've kept my jsFiddle updated with my local changes if anyone is willing to take a look. This is going to be a nice basic mobile example for somebody if I can just get this last bit figured out! http://jsfiddle.net/schlot/7t8Lu/1/ map definition:
map = new Map("mapDiv", {
basemap: "streets",
center: [-92.593, 38.5],
zoom: 6,
infoWindow: popup,
});
// divs
<div id="mapView" data-dojo-type="dojox/mobile/View" >
<div id="mapHeader" data-dojo-type="dojox/mobile/Heading">
<ul data-dojo-type="dojox/mobile/TabBar" data-dojo-props='barType:"segmentedControl"'>
<li data-dojo-type="dojox/mobile/TabBarButton" data-dojo-props='selected:true, moveTo:"mainView"'>Main</li>
<li data-dojo-type="dojox/mobile/TabBarButton" data-dojo-props='moveTo:"listView"'>Advisory List</li>
</ul>
</div>
<div id="mapContainer" data-dojo-type="dojox/mobile/ContentPane">
<div id="HomeButton"></div>
<div id="mapDiv">
</div>
</div>
</div>
... View more
03-06-2014
07:26 AM
|
0
|
0
|
616
|
|
POST
|
I'm expanding on a basic mobile example, trying to add a featurelayer of my own data and list of fish advisories (how many of what kinds of fish it's safe to eat from a river). It opens with a choice of viewing a list or a map. From the list, the user should be able to click the map button to zoom into that river. When viewing the map first, it is extremely cropped on the sides,and doesn't initially load my featurelayer, which generates errors (unable to draw graphic). There is a map load event that is supposed to manage the screen resolution and set the display. I've tried commenting the line that fires that map on load event, but it is still cropped. If I start with the list, the first time I click the map button, it doesn't draw, giving errors on the featurelayer. But subsequent selections do show the featurelayer and its zoomed to the correct river. Obviously events are not firing/responding in the order I expect to see them. I have no clue why my map is only showing for a few seconds before it disappears. I still haven't figured out how to post my code anywhere for people to view and edit it for me. That's a whole other thread to post! Update: Here's my first attempt at using JSFiddle. At least this made me try again to use it! http://jsfiddle.net/schlot/7t8Lu/1/
... View more
03-05-2014
07:45 AM
|
0
|
2
|
918
|
|
POST
|
I am working through a basic mobile example using dojo and the 3.8 compact build. When I go to the mobile view that shows the map, it is cropped to a very narrow width. I thought at first I had a style problem, but everything is set to width of 100% . In my Firebug console, I'm getting an error on two of the base map tiles. I have switched to a different base map, from topo to streets, and I'm getting the same type of error: "NetworkError: 404 Not Found - http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/19/196231/124095?blankTile=false" 124095...e=false "NetworkError: 404 Not Found - http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/18/98115/62047?blankTile=false" Has anyone encountered this before? I am getting some of the tiles, just not all of them. I remember there were some recent updates to the base maps. My other maps that use them draw fine, I'm just having problems with this one map.
... View more
02-26-2014
05:07 AM
|
0
|
1
|
2478
|
|
POST
|
There was a blog post written by Chris Mahlke a while back that described how to apply media queries in your code to be more responsive to various screen resolutions and sizes. http://blogs.esri.com/esri/arcgis/2012/08/24/applying-media-queries-to-your-arcgis-api-for-javascript-applications/ There was also a place to download the entire sample. It works as-is, but I was hoping to rewrite it in AMD-style. I've started over twice and I'm not having any luck. I'm lost in a few different places: I'm not sure about the mobile style sheets, they are several versions back and the overall paths I know have changed. I'm also not sure about the AMD equivalent of
dojo.requireIf("!dojo.isWebKit, "dojox.mobile.compat");
Maybe I should just require it, rather than having any sort of 'if'? Does anybody remember this posting? And maybe updated it with AMD-style instead?
... View more
02-06-2014
06:46 AM
|
0
|
1
|
1083
|
|
POST
|
These are really long lines, like the Mississippi River running the whole length of the state, so the first vertex isn't going to look right. Instead I figured out what the center vertex was and used that. Thanks for your assistance, you got me going in the right direction. grid.on('.dgrid-row:click',function(event){ var row = grid.row(event); var featureLayer = app.map.getLayer("riverLayer"); var gridQuery = new Query(); gridQuery.objectIds = [row.data.id]; featureLayer.on('error', function(err){ console.log ("error in gridClick is " + err.error); }); featureLayer.on('selection-complete', function (results) { if ( results.features.length > 0 ) { var feature = results.features[0]; app.map.setExtent(feature.geometry.getExtent()); feature.setInfoTemplate(infoTemplate); var vertices = feature.geometry.paths[0].length; var centerPtLoc = Number.round(vertices/2, 0); //center vertex var centerPt = feature.geometry.getPoint(0,centerPtLoc); app.map.infoWindow.setFeatures(results.features); app.map.infoWindow.show(centerPt); } }); featureLayer.selectFeatures(gridQuery); }); }
... View more
01-31-2014
06:59 AM
|
0
|
0
|
1597
|
|
POST
|
You're absolutely right about that and I've fixed it. Unfortunately that didn't totally take care of my problem. Your reply made me realize I also need to look up the syntax for placing the infoWindow. I'm going to have to figure out a point along the polyline to be the location where it's placed. I thought I could find some examples of that very quickly, but so far I've not figured it out. I've commented out those lines, and I see that I am getting results.
grid.on('.dgrid-row:click',function(event){
var row = grid.row(event);
var featureLayer = app.map.getLayer("riverLayer");
var gridQuery = new Query();
gridQuery.objectIds = [row.data.id];
featureLayer.on('error', function(err){
console.log ("error in gridClick is " + err.error);
});
featureLayer.on('selection-complete', function (results) {
if ( results.features.length > 0 ) {
var feature = results.features[0];
feature.setInfoTemplate(infoTemplate);
app.map.setExtent(feature.geometry.getExtent());
var resultGeometry = feature.geometry;
// app.map.infoWindow.setFeatures(results);
// app.map.infoWindow.show(resultGeometry);
}
});
featureLayer.selectFeatures(gridQuery);
});
}
At least now I know what lines to focus on.
... View more
01-31-2014
05:02 AM
|
0
|
0
|
1597
|
|
POST
|
I have a dGrid that is populated based on the current map extent. I have a listener on the map for extent-change that changes the contents of the grid based on what's currently showing on the map. The elements I'm working with are in a featureLayer. riverLayer = new FeatureLayer(pathName+"/arcgis/rest/services/fishAdvisoryRiver/MapServer/0", {mode: FeatureLayer.MODE_SNAPSHOT, id: "riverLayer", outFields: ["*"], infoTemplate: infoTemplate }); app.map.addLayers([riverLayer]); app.map.on("extent-change", function (currentMap) { currentExtent = app.map.extent; updateGrid(); }); function updateGrid () { var query = new Query(); query.geometry = currentExtent; query.outFields = ["OBJECTID", "NAME", "LABELFIELD"]; query.outSpatialReference = spatialReference; var queryTask = new QueryTask(riverLayer.url); queryTask.on ('error', queryErrorHandler); queryTask.execute(query, updateGridHandler); } function queryErrorHandler(err) { console.log ("error in queryTask is " + err.error); } function updateGridHandler (featureSet) { var data = []; if (grid) { grid.refresh(); } data = arrayUtil.map(featureSet.features, function (feature) { return { 'id': feature.attributes.OBJECTID, 'name': feature.attributes.NAME, 'label': feature.attributes.LABELFIELD }; }); grid = new Grid({ renderRow: renderRowFunction, showHeader: false }, "grid"); grid.renderArray(data); grid.sort('name'); grid.on('.dgrid-row:click',function(event){ var row = grid.row(event); var featureLayer = app.map.getLayer("riverLayer"); var gridQuery = new Query(); gridQuery.objectIds = [row.data.id]; featureLayer.on('error', function(err){ console.log ("error in gridClick is " + err.error); }); featureLayer.on('selection-complete', function (results) { if ( results.length > 0 ) { var feature = results[0]; feature.setInfoTemplate(infoTemplate); app.map.centerAndZoom(results[0].geometry,14); var resultGeometry = results[0].geometry; app.map.infoWindow.setFeatures(results); app.map.infoWindow.show(resultGeometry); } }); featureLayer.selectFeatures(gridQuery); }); } function renderRowFunction (obj,options) { var template = '<div class="title">${0}</div><div class="subtitle"><div class="details">${1}</div>'; return dojo.create("div",{ innerHTML : dojo.string.substitute(template,[obj.name,obj.label]) }); } The extent-change listener works great, it only lists what's on the map. The problem is with the row click on the grid. It doesn't do anything at all when I click. I use this same code in another project, the only difference is the features are points, as opposed to lines. Originally I had the grid.on 'click' without the 'selection-complete' syntax. I thought maybe that the querying of a line took so much longer, I was getting hung up here. The lines do have a lot of vertices, but there's less than 50 lines in the whole layer, so it's not like it's bogging down. I can see that the objectID is found from the data in the grid row, and it's a valid objectID. // ORIGINAL GRID CLICK CODE grid.on('.dgrid-row:click',function(event){ var row = grid.row(event); var featureLayer = app.map.getLayer("riverLayer"); var gridQuery = new Query(); gridQuery.objectIds = [row.data.id]; featureLayer.selectFeatures(gridQuery, esri.layers.FeatureLayer.SELECTION_NEW, function(results) { if ( results.length > 0 ) { var feature = results[0]; feature.setInfoTemplate(infoTemplate); app.map.centerAndZoom(results[0].geometry,14); var resultGeometry = results[0].geometry; app.map.infoWindow.setFeatures(results); app.map.infoWindow.show(resultGeometry); } }); }); I'm at a loss why this worked just fine in my other point layer, but doesn't work with my lines. I get no error, it just doesn't do anything. I must have something out of sequence, I would expect to at least get an error from my errorHandlers.
... View more
01-30-2014
12:54 PM
|
0
|
4
|
3531
|
|
POST
|
Both legacy and deprecated? Interesting. Is there a new object that could replace DeferredList?
... View more
01-29-2014
09:45 AM
|
0
|
0
|
3238
|
|
POST
|
If I understand what you're saying, you'd like a basic template, similar to what is available in FLEX that easily configurable, but that isn't based on ArcGIS.com. There's lots of threads where people are asking for just that, but I don't think there is such a thing, at least nothing very current. Instead ESRI is pointing us all down the ArcGIS.com path. If you have no plans to go there (I don't have permission to post our data there myself), then you'll have to focus your attention on the examples that don't mention 'web map'.
... View more
01-28-2014
12:36 PM
|
0
|
0
|
1123
|
|
POST
|
When looking at the examples, you don't want the ones that mention 'web map'. That is not a generic term, it means something in particular. A Javascript webmap IS ArcGIS.com. You'll need to look to some of the other samples to use your own map services that hosted locally. A web map encapsulates several things, the combination of layers you have, the information tags that come up when you click etc. You can't simply replace a few lines of code for 'webmap' and replace them with the Javascript 'map' object, which is basically a blank canvas. ESRI has a lot of cool web map templates to use, mostly based on ArcGIS.com hosted web maps. If you don't want use that environment, you'll need to pass over those and look for other examples.
... View more
01-28-2014
10:48 AM
|
0
|
0
|
1123
|
|
POST
|
I see why you need to do this, but it looks to me that 'result' at this point doesn't know where it came from. You'll have to somehow capture this information maybe at the point you define the identify tasks and parameters? Maybe in an array, although I'm not sure how you're going to retrieve that information back out again. I have a whole other set of functions that do a number of query tasks to generate grids of whatever the currently visible layers. That made me study deferred/promise/all from a slightly different angle. Let me see if anything in that might apply in this situation.
... View more
01-07-2014
11:49 AM
|
0
|
0
|
3238
|
|
POST
|
I did realize there were some updates to this dijit since the last time I downloaded it. But it still doesn't behave the way I want. It doesn't honor my setVisibleLayers. Or maybe my definition isn't the same. I expect to only see the layer I set with setVisibleLayers and nothing of the others from that service.
... View more
12-06-2013
12:35 PM
|
0
|
0
|
3048
|
|
POST
|
If I limit the layers that are visible in my ArcGISDynamicMapService layer using setVisibleLayers, how can I modify the TOC.js dijit to honor these? I have multiple layers in this service and I only need one of them for this particular project. If I limit what is loaded, I get empty checkboxes for the other layers that aren't visible, but without any labels next to them. No group layers or anything involved, just a service with more than one layer in it. I thought I read another thread about this, but I couldn't search it out. [ATTACH=CONFIG]29657[/ATTACH]
var countyLayer = new ArcGISDynamicMapServiceLayer(pathName+"/ArcGIS/rest/services/BaseMap/BasicBoundary/MapServer", {id:'countyLayer', visible:false})
countyLayer.setVisibleLayers([3]);
//other layers I added, map gets created ....
app.map.on("layers-add-result", function (event) {
try {
var toc = new agsjs.dijit.TOC({
map: app.map,
layerInfos: [{
layer: controlLayer,
title: "Control Points"
},{
layer: plssLayer,
title: "Public Land Survey System"
},{
layer: twpRngLayer,
title: "Township / Range"
},{
layer:countyLayer,
title:"Missouri Counties"
}]
}, 'tocDiv');
toc.startup();
}
catch (e) {
console.log(e.message);
}
});
I have poked around a bit in the TOC code, but I think this is the original behavior and not something I've introduced by accident.
... View more
12-06-2013
11:30 AM
|
0
|
7
|
5991
|
| 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
|