I have a watchUtil for a popup opening, to trigger a related table query. Works perfectly when a user clicks on a feature on the map but when a grid row is clicked the relationshipQuery doesnt return any results.
watchUtils.when(app.view.popup, "selectedFeature", function photos(evt){
console.log(app.view.popup.selectedFeature);
query("#panelDetails").removeClass("in");
var objectID = app.view.popup.selectedFeature.attributes.OBJECTID;
console.log(objectID);
var queryTask = new QueryTask({
url: "https://services.arcgis.com/ZzrwjTRez6FJiOq4/arcgis/rest/services/Core_Locations_20171129/FeatureSer..."
});
relationQuery = new RelationshipQuery({
objectIds: [objectID],
outFields: ["Filename", "directory", "TYPE", "Usage", "Top_Depth", "Bottom_Depth"],
relationshipId: 1
});
console.log(relationQuery);
queryTask.executeRelationshipQuery(relationQuery).then(function(rslts){
document.getElementById("attDetails").innerHTML = "";
//No rslt given back here when clicking on dgrid
console.log(rslts);
var features = rslts[objectID].features;
console.log(features);
Solved! Go to Solution.
It is the same up until console log on line 21. I get an empty array returned when the grid row is clicked.
Jay,
Strange indeed. I normally see an issue where people are using the dgrid id field and it is returning as a string instead of a number and they don't realize that, but does not seem to be your case.
Ya stumped me. I figured it had something to do with the RelationshipQuery.
can i email ya the live link?
Sure message it to me.
ha says i cant send ya a message
try again
Jay,
So this is what I am finding. Your Search widget is not returning the right features for the search. When I search for "#D-616 (STATE) LISBON" it returns 4 features and here are the objectids of those results (3048,3049,3050,3051).
When I click on the well with the actual name of "#D-616 (STATE) LISBON" its objectid is actually 2892. So the reason your images are not working for the dgrid click is the objectids in the results are not the correct ones. Now as to why the search is messing up so bad... I am not real sure. The one thing I see that is off is the JS is case sensitive and you have
searchFields: ["UWI","Well_Name", "Operator", "PROD_FORM", "Township", "Range"],
The "Operator" in the above list is not the correct field name it is "OPERATOR". See if that makes a difference.
Doh, my search sources was referencing old data still! We had moved this project to AGOL over the holidays and the URL never got updated.
Great,
Glad to help you figure this out.
Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.