POST
|
Hi friends I am trying to show the attributes of the service layer by query task in the following manner: But some how I am not able to show them in the data grid ..Can some please guide me on this ..Thank You Below is the search.Html (Template) page code:
<div class="gis_SearchDijit">
<div class="formContainer">
<div data-dojo-type="dijit.form.Form" data-dojo-attach-point="searchFormDijit">
<table cellspacing="5" style="width:100%; height: 49px;">
<tr>
<td>
<input id="searchText" type="text" data-dojo-type="dijit.form.ValidationTextBox" data-dojo-props="name:'searchText',trim:true,required:true,style:'width:100%;'"
/>
</td>
</tr>
</table>
</div>
</div>
<div class="buttonActionBar">
<div data-dojo-type="dijit.form.Button" data-dojo-props="busyLabel:'searching',iconClass:'searchIcon'" data-dojo-attach-event="click:search">
Search
</div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'" style="height:150px;">
<table data-dojo-type="dojox/grid/DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
<thead>
<tr>
<th field="id">Id</th>
<th field="name" >name</th>
</tr>
</thead>
</table>
</div>
The Search.js page code is as below
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'dijit/form/Form',
'dijit/form/FilteringSelect',
'dijit/form/ValidationTextBox',
'dijit/form/Button',
'dijit/TooltipDialog',
'esri/tasks/query',
'esri/tasks/QueryTask',
'esri/config',
'dojo/store/Memory',
'dojo/_base/lang',
'dojo/_base/array',
'dojo/text!./Search/templates/Search.html',
"dojox/grid/DataGrid",
"dojo/data/ItemFileReadStore",
'dojo/dom'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Form, FilteringSelect, ValidationTextBox, Button, TooltipDialog, query, QueryTask, esriConfig, Memory, lang, array, searchTemplate, DataGrid, ItemFileReadStore,dom) {
//anonymous function to load CSS files required for this module
(function () {
var css = [require.toUrl("gis/dijit/Search/css/Search.css")];
var head = document.getElementsByTagName("head").item(0),
link;
for (var i = 0, il = css.length; i < il; i++) {
link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = css.toString();
head.appendChild(link);
}
} ());
// Main print dijit
var Search = declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
widgetsInTemplate: true,
templateString: searchTemplate,
map: null,
defaultTitle: null,
queryTask: null,
query: null,
_store1: null,
_selectorOne: null,
postCreate: function () {
this.inherited(arguments);
this.queryTask = new esri.tasks.QueryTask(this.queryTaskURL);
this.query = new esri.tasks.Query();
this.query.outSpatialReference = this.map.spatialReference;
this.query.returnGeometry = true;
this.query.outFields = ["id", "ASTName"];
},
search: function () {
//this.query.where = "APP_ID like '%" + dom.byId("searchText").value + "%' OR PAMS_PIN LIKE '%" + dom.byId("searchText").value + "%'";
this.query.where = " id like '%" + dom.byId("searchText").value + "%'";
this.queryTask.execute(this.query, lang.hitch(this, function (results) {
var grid = this.grid;
this._selectorOne = this.grid;
this._selectorOne.id = "grid";
var resultItems = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features.attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
// var element = dom.byId('queryResults');
// element.
//create array of attributes
var dataItems = {
identifier: "id", //This field needs to have unique values
label: "id",
'items': resultItems
};
store = new ItemFileReadStore({ data : dataItems });
grid = registry.byId("grid");
grid.setStore(store);
//////// //zoom to the first feature
//////// if (resultCount > 0) {
//////// var extent = results.features[0].geometry.getExtent();
//////// this.map.setExtent(extent);
//////// }
}),
function (err) {
console.log(err);
});
},
});
return Search;
});
... View more
04-12-2014
04:23 PM
|
0
|
0
|
2015
|
POST
|
I got my task completed with help of this thread: http://forums.arcgis.com/threads/28794-data-collection-WPF Posting it here so that some one seeking the same cause can take note of it. now i would like to open a feature grid when clicked on a point showing the point attributes ? Cans someone please suggest few ideas.. Thank You
... View more
05-20-2013
11:35 AM
|
0
|
0
|
138
|
POST
|
Hi friends, I am very new to WPF Arcgis for mobile. I am not able to find good resources as well. I am trying to make new points on my map when a user clicks on it. This is what i have so far. But it just makes on point on the centre of my map extent. Can some one please show me how to create points on mouse click and add the new feature to the feature table. Thank you in advance private void map1_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var mobileCache1 = MobileCacheMap.GetMapLayerFromCache();
map1.MapLayers.Add(mobileCache1);
var myGeometry = new ESRI.ArcGIS.Mobile.Geometries.Point(new ESRI.ArcGIS.Mobile.Geometries.Coordinate(map1.FullExtent.XCenter, map1.FullExtent.YCenter));
//map1.ExtentChanged += new EventHandler(map1_ExtentChanged);
GraphicLayer gl = new GraphicLayer();
map1.MapGraphicLayers.Add(gl); // add graphic layer to the map control
gl.GeometryBag.Add(myGeometry); // add a geometry to the graphic layer
}
... View more
05-17-2013
01:50 PM
|
0
|
1
|
2252
|
POST
|
So you want to use the map service or the feature service of it.. If You want the map service then your line of code is good but if its feature service you are looking add then you need to change it to a feature layer and not Dynamic layer.
... View more
06-08-2012
01:47 PM
|
0
|
0
|
681
|
POST
|
changing this line of code to the following way helped me selectQuery.geometry = pointToExtent(map, evt.mapPoint, 3); //buffers click point by number of pixels(3) ... function pointToExtent(map, point, toleranceInPixel) { var pixelWidth = map.extent.getWidth() / map.width; var toleraceInMapCoords = toleranceInPixel * pixelWidth; return new esri.geometry.Extent(point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference); }
... View more
06-06-2012
12:18 PM
|
0
|
0
|
193
|
POST
|
Thank JGaa..Your solution has worked for mine...Thanks A lot..
... View more
06-06-2012
12:06 PM
|
0
|
0
|
520
|
POST
|
In the sample beolw http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_attribute_inspector.html what does this line signify..selectQuery.geometry = evt.mapPoint; Somehow I am not able to return evt.mappoint objetct that it needs to return when I add an alert(map.evt)..Can someone guide me on this Thank you in advance
... View more
06-06-2012
11:34 AM
|
0
|
2
|
486
|
POST
|
Can someone please let me know know as to why when i click on my feature points , the info window is not showing up: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Editable FeatureLayer in Selection Only Mode with Attribute Inspector</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body {
height: 98%; width: 98%;
padding: 0;
overflow:hidden;
}
#mapDiv{
padding:0;
border: solid 2px #705B35;
}
.roundedCorners {
-moz-border-radius: 4px;
border-radius: 4px;
}
#detailPane{
height:20px;
color:#570026;
font-size:12pt;
font-weight:600;
overflow:hidden;
}
.dj_ie .infowindow .window .top .right .user .content { position: relative; }
.dj_ie .simpleInfoWindow .content {position: relative;}
.esriAttributeInspector {height:100px;}
.esriAttributeInspector .atiLayerName {display:none;}
.saveButton {
padding-left:45px;
margin:0px;width:16px; height:16px;
}
</style>
<script type="text/javascript"> var dojoConfig = { parseOnLoad: true };</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script>
<script type="text/javascript" language="Javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.AttributeInspector-all");
var map;
var updateFeature;
function init() {
//This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to
//replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic
//for details on setting up a proxy page.
esri.config.defaults.io.proxyUrl = "proxy.ashx";
esri.config.defaults.io.alwaysUseProxy = true;
var startExtent = new esri.geometry.Extent({
"xmin": -10591408.5633053,
"ymin": 3383311.8650482,
"xmax": -10541870.717486,
"ymax": 3428122.96783653,
"spatialReference": {
"wkid": 3857
}
});
map = new esri.Map("mapDiv", {
extent: startExtent
});
dojo.connect(map, "onLoad", function () {
//resize the map when the browser resizes
dojo.connect(dijit.byId('mapDiv'), 'resize', map, map.resize);
});
dojo.connect(map, "onLayersAddResult", initSelectToolbar);
var tiledLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
map.addLayer(tiledLayer);
var petroFieldsMSL = new esri.layers.ArcGISDynamicMapServiceLayer("http://test.com/ArcGIS/rest/services/Houston/Test/MapServer");
petroFieldsMSL.setDisableClientCaching(true);
map.addLayer(petroFieldsMSL);
var petroFieldsFL = new esri.layers.FeatureLayer("http://test.com/ArcGIS/rest/services/Houston/Test/FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_SELECTION,
outFields: ["APP_ID","OBJECTID","VACANT"]
});
var selectionSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, new esri.symbol.SimpleLineSymbol("dashdot", new dojo.Color("yellow"), 2), null);
petroFieldsFL.setSelectionSymbol(selectionSymbol);
dojo.connect(petroFieldsFL, "onEditsComplete", function () {
petroFieldsMSL.refresh();
});
map.addLayers([petroFieldsFL]);
}
function initSelectToolbar(results) {
var petroFieldsFL = results[0].layer;
var selectQuery = new esri.tasks.Query();
dojo.connect(map, "onClick", function (evt) {
selectQuery.geometry = evt.mapPoint;
petroFieldsFL.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
if (features.length > 0) {
//store the current feature
updateFeature = features[0];
map.infoWindow.setTitle(features[0].getLayer().name);
map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
} else {
map.infoWindow.hide();
}
});
});
dojo.connect(map.infoWindow, "onHide", function () {
petroFieldsFL.clearSelection();
});
var layerInfos = [{ 'featureLayer': petroFieldsFL,
'showAttachments': true,
'isEditable': true,
'fieldInfos': [
{ 'fieldName': 'APP_ID', 'isEditable': true, 'tooltip': 'APP_ID', 'label': 'APP_ID:' },
{ 'fieldName': 'Vacant', 'isEditable': true, 'tooltip': 'Vacant', 'label': 'Vacant:' },
]
}];
var attInspector = new esri.dijit.AttributeInspector({
layerInfos: layerInfos
},
dojo.create("div")
);
//add a save button next to the delete button
var saveButton = new dijit.form.Button({ label: "Save", "class": "saveButton" });
dojo.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");
dojo.connect(saveButton, "onClick", function () {
updateFeature.getLayer().applyEdits(null, [updateFeature], null);
});
dojo.connect(attInspector, "onAttributeChange", function (feature, fieldName, newFieldValue) {
//store the updates to apply when the save button is clicked
updateFeature.attributes[fieldName] = newFieldValue;
});
dojo.connect(attInspector, "onNext", function (feature) {
updateFeature = feature;
console.log("Next " + updateFeature.attributes.objectid);
});
dojo.connect(attInspector, "onDelete", function (feature) {
feature.getLayer().applyEdits(null, null, [feature]);
map.infoWindow.hide();
});
map.infoWindow.setContent(attInspector.domNode);
map.infoWindow.resize(325, 210);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width:100%;height:100%;">
<div id="detailPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'">
Houston App
</div>
<div data-dojo-type="dijit.layout.ContentPane" class="roundedCorners" data-dojo-props="region:'center'" id="mapDiv"></div>
</div>
</body>
</html>
... View more
06-06-2012
07:39 AM
|
0
|
2
|
298
|
POST
|
Thank You Bfou for your response.. Got My feature points through MapServerice..
... View more
06-06-2012
06:13 AM
|
0
|
0
|
435
|
POST
|
Hi friends I am trying use the following samplehttp: //help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_attribute_inspector.html The problem..is that when i change the feature layer to my url like this, the feature points do not show on the base map. var petroFieldsFL = new esri.layers.FeatureLayer("http://test.com/ArcGIS/rest/services/Houston/Test/FeatureServer/0", { mode: esri.layers.FeatureLayer.MODE_SELECTION, outFields: ["test1","objectid","Vacant"] }); But when i change the mode:esri.layers.FeatureLayer.MODE_SNAPSHOT , they show up.....what is the difference between the sample feature service and mine... how can i get it work in selection mode Thank you in advance
... View more
06-05-2012
07:24 PM
|
0
|
2
|
3986
|
POST
|
Hi friends, I am using the following sample to store the data for my feature layer: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/exp_localstorage.html How can i transfer the data from local storage to my feature service server .can someone please give suggestions... Thank you in advance
... View more
06-04-2012
08:12 AM
|
0
|
4
|
1653
|
POST
|
Hi friends, When I changes this code esri.config.defaults.io.alwaysUseProxy = true; to esri.config.defaults.io.alwaysUseProxy = false; I am not having any problems in loading the base map but i need the setting to be true in order for the user to avoid entering username password ...Someone please give me some insight? Thank you
... View more
06-04-2012
07:48 AM
|
0
|
0
|
301
|
POST
|
In stead of Bing map I am using ESRi base maps like this url: http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer...This is somewhat Ok for me.
... View more
06-01-2012
12:54 PM
|
0
|
0
|
199
|
POST
|
Hi friends, I am using the below code to load a base map of esri and to it i am trying to add an dynamic map service layer but my base map does not load completely and leaves blank tiles in between when I try to add my dynamic map service. What could be the reasons..Is it related to projections or something else?Please check my code below and give me suggestions...Thank you in advance <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Set Map Extent Using Second Service</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script> <script type="text/javascript"> dojo.require("esri.map"); var myMap, myService1, myService2; function initLayers() { esri.config.defaults.io.proxyUrl = "proxy.ashx"; esri.config.defaults.io.alwaysUseProxy = true; var primaryMapServiceURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"; myService1 = new esri.layers.ArcGISTiledMapServiceLayer(primaryMapServiceURL); var secondaryMapServiceURL = "http://test.com/ArcGIS/rest/services/Houston/ParcelsTest/MapServer"; myService2 = new esri.layers.ArcGISDynamicMapServiceLayer(secondaryMapServiceURL, { opacity: 0.75 }); var layerLoadCount = 0; //When both layers have loaded, run createMapAddLayers if (myService1.loaded) { layerLoadCount += 1; if (layerLoadCount === 2) { createMapAddLayers(myService1, myService2); } } else { dojo.connect(myService1, "onLoad", function (service) { layerLoadCount += 1; if (layerLoadCount === 2) { createMapAddLayers(myService1, myService2); } }); } if (myService2.loaded) { layerLoadCount += 1; if (layerLoadCount === 2) { createMapAddLayers(myService1, myService2); } } else { dojo.connect(myService2, "onLoad", function (service) { layerLoadCount += 1; if (layerLoadCount === 2) { createMapAddLayers(myService1, myService2); } }); } } //Create a map, set the extent, and add the services to the map. function createMapAddLayers(myService1, myService2) { //create map //convert the extent to Web Mercator myMap = new esri.Map("mapDiv", { extent:(myService2.fullExtent) }); myMap.addLayer(myService1); myMap.addLayer(myService2); } dojo.addOnLoad(initLayers); </script> </head> <body class="claro"> <div id="mapDiv" style="width:600px; height:400px; border:1px solid #000;"></div> <br/> This map shows two services: <ul> <li>An ArcGIS Online tiled service that has a world extent.</li> <li>A second dynamic service with an extent of the State of Kansas. This is the extent used when the maps are first displayed. </li> </ul> Note that if you want to combine to tiled services in the same map, they must have the same tile configuration. </body> </html>
... View more
06-01-2012
12:53 PM
|
0
|
1
|
656
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|