I am using the ESRI Javascript API to write a mobile web application. I have used the PopupMobile
widget for viewing/editing attributes. This widget creates a popup on the map when a feature(s) is clicked and then provides a button to access the attributes in a new page.
I would like to bypass the popup altogether and go directly to the attribute page. Is this possible?
UPDATE:
I created my own onClick
handler instead of using the PopupMobile
widget, but I'm getting some very interesting results in my attributes page.
Here is a screenshot of the AttributeInspector
widget as it displays on the page I set up in my application:
As you can see, the various dijits
that make up the AttributeInspector
are not displaying properly on the page.
Here is the code I used to set up the AttributeInspector
:
mapDeferred.addCallback(function(response) {
map = response.map;
currentItem = response.itemInfo;
$("#webmapTitle").html(currentItem.item.title);
resizeMap();
var fl = currentItem.itemData.operationalLayers[3].layerObject
var layerInfo = [{
featureLayer : fl
}];
var attInspector = new AttributeInspector({
layerInfos : layerInfo
}, "attributeInspector");
attInspector.startup();
dojo.connect(map, "onClick", function(evt) {
var toleranceInPixels = 10;
var pnt = evt.mapPoint;
var pixelWidth = map.extent.getWidth() / map.width;
var toleranceInMapCoords = toleranceInPixels * pixelWidth;
var ext = new esri.geometry.Extent(pnt.x - toleranceInMapCoords,
pnt.y - toleranceInMapCoords,
pnt.x + toleranceInMapCoords,
pnt.y + toleranceInMapCoords,
map.spatialReference);
var q = new esri.tasks.Query();
q.geometry = ext;
fl.selectFeatures(q)
$.mobile.changePage($("#attributePage"));
})
});
And here is the markup:
<!--Attribute Page-->
<div id="attributePage" data-role="page">
<div data-role="header">
<h1><span>Attributes</span></h1>
<a href="#mapPage" id="mapPageBtn5" data-rel="page" data-theme='b'
class="ui-btn-right">Map</a>
</div>
<div data-role="content">
<div id="attributeInspector"></div>
</div>
</div>
onClick
handler to do this, but the Attribute Inspector widget does not appear correctly in the new page. – Brian Apr 1 at 14:31