I have a grid that I populate with the results of a selection on the map. I am trying to add the ability to perform text search using findtask. From what I can see the findtask executes just fine, I can log the results in console. Can anyone tell me why the grid is not updating when I run findtask?findTask = new esri.tasks.FindTask(".../services/aasggeothermal/AZWellHeaders/MapServer");
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["apino"];
findParams.outSpatialReference = map.spatialReference;
function apiSearch(){
findParams.searchText = dojo.byId("textSearch").value;
findTask.execute(findParams, updateGrid);
}
I think my problem is in one of my loops.function updateGrid(featureSet){
console.log(featureSet);
var data=[];
var grid = dijit.byId('grid');
dojo.forEach(featureSet, function (entry) {
var logs = [],
las = [],
folders = [],
relatedResource = entry.attributes.relatedresource === null ? "no value" : entry.attributes.relatedresource;
//relatedResource = entry.attributes.relatedresource || "";
//if (entry.attributes.relatedresource === null) {
//}
//if ( relatedResource.length >=4){
var raw = relatedResource.split("|");
raw.forEach(function (bit){
var resource = bit.split(", ");
if (resource[0] && resource[1]){
var url = resource[1].trim();
var name = resource[0].trim();
}
var anchor = "<li><a href='" + url + "' target='_blank'>" + name + "</a></li>";
if (url != null ){
if ( url.indexOf(".tif", url.length -4) !==-1){
logs.push(anchor);
}
if ( url.indexOf(".pdf", url.length -4) !==-1){
folders.push(anchor);
}
if ( url.indexOf(".las", url.length -4) !==-1){
las.push(anchor);
}
}
});
//}
data.push({
objectid:entry.attributes.objectid,//0
apino:entry.attributes.apino,//1
otherid:entry.attributes.otherid,//2
wellname:entry.attributes.wellname,//3
county:entry.attributes.county,//4
twp:entry.attributes.twp,//5
rge:entry.attributes.rge,//6
section_:entry.attributes.section_,//8
drillertotaldepth:entry.attributes.drillertotaldepth,//9
formationtd:entry.attributes.formationtd,//10
wellname:entry.attributes.wellname,//11
logField: '<ul>' + logs.join(" ") + '</ul>',
lasField: '<ul>' + las.join(" ") + '</ul>',
folderField: '<ul>' + folders.join(" ") + '</ul>'
});
});
var dataForGrid= {
items: data
};
var store = new dojo.data.ItemFileReadStore({data:dataForGrid});
grid.setStore(store);
}