I have a query set up that feeds the results into an infoWindow. However, before adding the results to the infoWindow, I would like to reorder the query results so that the first item in the infoWindow is the feature that the user has clicked on in the map (currently the first item is the first query result, which geographically may be elsewhere than where the user clicked). What I have is a route that has been driven, with photos taken along the way - ideally the user can click a photo point, and the infoWindow will allow them to scroll backwards and forwards along the route to view adjacent photos.
I've set up a jsfiddle here. (My own services are on an intranet so couldn't use them in the fiddle) What is being returned from the query seems to be a multidimensional array, but I'm not sure. I can't get to any of the results using syntax that should work for a multidimensional array, such as queryDeferred[0].length, etc. Here are the results if I log queryDeferred to the console:
This suggests the array queryDeferred contains two more arrays, 0 and 1 (and 1 is empty?).
Expanding array 0:
Alternatively instead of reordering the results of the query, maybe I could just advance the infoWindow to the user-selected photo? But how do I determine what is the current feature shown in the infoWindow? I have a data attribute called FRAMENO which always starts at 0001. If I could advance the infoWindow to show the FRAMENO of the photo the user selected that would work. So I have a total of 221 photos returned by the query, and if the user clicked on FRAMENO = 0043, how would I tell the infoWindow to advance to 0043 before showing?