Solved! Go to Solution.
Can you post the entire code in JSFiddle? Thanks.
let me know if need the complete source code i can share it with you,i never used jsfiddle.
That will be great if you can post your complete source code. Thanks for your time.
Thank you for posting your code. I run your index.html but no result return. Am I missing something?
What are you trying to do?what is your requirement?
I try to find a sample query able to search subdivision, city, parcel by address & parcel id when using enter information in the text box. Then return results in datagrid. I only find sample using Find task but not using query Task. Besides that, would like to have select option for city so able to select and zoom to the city boundary.
Thanks.
Here is the code to query a layer:
function init() {
center = [-72.65065, 41.56232];
zoom = 11;
map = new esri.Map("map", {
basemap: "topo",
// center: center,
zoom: zoom
});
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(
"http://12.132.106.112:6080/arcgis/rest/services/MidParcelFabric/MapServer");
map.addLayer(dynamicMapServiceLayer);
queryTask = new esri.tasks.QueryTask(
"http://12.132.106.112:6080/arcgis/rest/services/MidParcelFabric/MapServer/1");
query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = [ "OLD_MBL_1", "MAPLOT_1" , "MAP_1", "LOT_1", "CAMAACCT_1", "pid", "PROPERTY_LOCATIO", "STREET_NUMBER", "STREET_NAME" ,"UNIT__", "GRANTEE", "CO_GRANTEE_S_NAM", "Shape_Length", "Shape_Area" ];
symbol = new esri.symbol.SimpleFillSymbol();
symbol.style = esri.symbol.SimpleFillSymbol.STYLE_SOLID;
symbol.color = new dojo.Color([98, 194, 204, 0.5]);
}
dojo.addOnLoad(init);
function executeQueryTask(streetName,streetNumber,ownerName,maplot,lot,unit,accountID,pid) {
var queryString="";
queryString+= "STREET_NAME" + " like '%" + streetName +"%'" ;
queryString+= " OR " + "GRANTEE" + " like '%" + streetName +"%'" ;
//queryString+= " OR " + "pid" + " = " + streetName ;
console.log(queryString);
query.where = queryString;
queryTask.execute(query, showResults);
}
Call executeQuery() upon click or a search button or enter button,pass required parameters.
Pass the city value also to this function.
If you want a dojo datagrid instead of html table use the new.html in the code that i have given you.
Let me know if this solves your problem.
Thank you for your time. I will work on it and let you know.