That does look like what I want. Now to make sure I capture the right
page... thanks so much for your help.

On Dec 8, 12:42 pm, Jeremy Geerdes <[email protected]> wrote:
> I would put it right at the top of the searchComplete method, like this...
>
> function searchComplete(){
>  var pageIWant = parseInt(document.getElementById('hdnCandPage').value);
>   if(searcher.cursor.currentPageIndex != pageIWant){
>     searcher.gotoPage(pageIWant);
>     return;
>   }
>
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
>
> For more information or a project quote:
> [email protected]
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
>
> On Dec 8, 2011, at 11:24 AM, ThisLooksPrettyCool wrote:
>
>
>
>
>
>
>
> > I think I accidentally hit the wrong button in replying. Let's try
> > this again...
>
> > Here is my searchcomplete function. Assuming I could accurately
> > capture the user's currentpage, where should I put the gotoPage
> > function call?
>
> > function searchComplete() {
> >            map.clearOverlays();
> >            var results = searcher.results; // Grab the results array
>
> >            var newIconRed = new GIcon(G_DEFAULT_ICON); // create new
> > red pin map marker icon
> >            newIconRed.image = "images/pin.png"; // icon image
> > location
> >            newIconRed.iconSize = new GSize(32, 32); // new icon
> > dimensions
> >            var markerRed = { icon: newIconRed }; // this is the new
> > red icon marker
>
> >            var newIconBlue = new GIcon(G_DEFAULT_ICON); // create new
> > blue pin map marker icon
> >            newIconBlue.image = "images/pinblue.png"; // icon image
> > location
> >            newIconBlue.iconSize = new GSize(32, 32); // new icon
> > dimensions
> >            var markerBlue = { icon: newIconBlue }; // this is the new
> > blue icon marker
>
> >            // We loop through the results array to get the points
> >            for (var i = 0; i < results.length; i++) {
> >                var result = results[i]; // Get the specific result
> >                var markerLatLng = new
> > google.maps.LatLng(parseFloat(result.lat), parseFloat(result.lng));
> >                // check if this location is targeted. If so, do not
> > show in red.
> >                if (checkForTargeted(result.lat, result.lng,
> > result.titleNoFormatting) == false) {
> >                    var marker = new google.maps.Marker(markerLatLng,
> > markerRed); // Create the red marker
>
> >                    // Bind information for the infoWindow aka the map
> > marker popup
>
> > marker.bindInfoWindow(result.html.cloneNode(true));
> >                    result.marker = marker; // bind the marker to the
> > result
> >                    map.addOverlay(marker); // add the marker to the
> > map
> >                }
> >            }
>
> >            var targets = getTargetsArray(); // Grab the targets array
> >            // We loop through the targeted array to get the points
> >            for (var i = 0; i < targets.length; i++) {
> >                var target = targets[i]; // Get the specific target
> >                // make sure target lat/lng is not 0, 0
> >                if (target.lat != 0 || target.lng != 0){
> >                    var markerLatLng = new
> > google.maps.LatLng(parseFloat(target.lat), parseFloat(target.lng));
> >                    var marker = new google.maps.Marker(markerLatLng,
> > markerBlue); // Create the blue marker
>
> >                    // Bind information for the infoWindow aka the map
> > marker popup
> >                    marker.bindInfoWindow(target.html);
> >                    target.marker = marker; // bind the marker to the
> > result
> >                    map.addOverlay(marker); // add the marker to the
> > map
> >                }
> >            }
>
> >            // Store where the map should be centered
> >            var center = searcher.resultViewport.center;
>
> >            // Calculate what the zoom level should be
> >            var ne = new
> > google.maps.LatLng(searcher.resultViewport.ne.lat,
> > searcher.resultViewport.ne.lng);
> >            var sw = new
> > google.maps.LatLng(searcher.resultViewport.sw.lat,
> > searcher.resultViewport.sw.lng);
> >            var bounds = new google.maps.LatLngBounds(sw, ne);
> >            var zoom = map.getBoundsZoomLevel(bounds, new
> > google.maps.Size(585, 255));
>
> >            // Set the new center of the map
> >            // parseFloat converts the lat/lng from a string to a
> > float, which is what
> >            // the LatLng constructor takes.
> >            map.setCenter(new
> > google.maps.LatLng(parseFloat(center.lat), parseFloat(center.lng)),
> > zoom);
> >        }
>
> > On Dec 8, 12:07 pm, Jeremy Geerdes <[email protected]> wrote:
> >> Well, you would just have to have a searchCompleteCallback which, upon the 
> >> return of the initial results, would check for that value and call 
> >> gotoPage accordingly.
>
> >> Jeremy R. Geerdes
> >> Generally Cool Guy
> >> Des Moines, IA
>
> >> For more information or a project quote:
> >> [email protected]
>
> >> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> >> Church!
>
> >> On Dec 8, 2011, at 10:59 AM, Phil Dahlheimer wrote:
>
> >>> I'm not sure that's much of a challenge. This code seems to be working 
> >>> fine in my searchcomplete function:
> >>>             map.setCenter(new google.maps.LatLng(parseFloat(center.lat), 
> >>> parseFloat(center.lng)), zoom);
>
> >>>             document.getElementById('hdnCandPage').value = 
> >>> searcher.cursor.currentPageIndex;
>
> >>> I'm storing the user's cursor.currentpageindex in a hidden field on the 
> >>> page. I don't think I'd have too much of a problem calling execute and 
> >>> going to the page. What would that look like and where would I put it?
>
> >>> On Thu, Dec 8, 2011 at 11:53 AM, Jeremy Geerdes <[email protected]> 
> >>> wrote:
> >>> Using the standard JSAPI, I don't believe you can do this without first 
> >>> calling .execute() and then .gotoPage(), which may be problematic the way 
> >>> you've described your app. You could write a custom JS wrapper for the 
> >>> RESTful API that would support what you're trying to do. The one 
> >>> challenge with that would be figuring out if there is, in fact, a second 
> >>> page of results.
>
> >>> Jeremy R. Geerdes
> >>> Generally Cool Guy
> >>> Des Moines, IA
>
> >>> For more information or a project quote:
> >>> [email protected]
>
> >>> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> >>> Church!
>
> >>> On Dec 8, 2011, at 10:20 AM, ThisLooksPrettyCool wrote:
>
> >>>> Specifically, want to load the search normally on page load (this
> >>>> works fine). After a user performs an action, I want to capture the
> >>>> page the user is looking at (which I can do), perform an off-map
> >>>> action (which I can do), rerun the search (which I can do) and land
> >>>> the user on the same page (which I cannot do), and then reload the map
> >>>> (which is automatic when the search reruns.
>
> >>>> I know that I need to use gotoPage(), but I can't find anywhere to put
> >>>> it in my function that works.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Google AJAX APIs" group.
> >>>> To post to this group, send email to
> >>>> [email protected]
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]
> >>>> To view this message on the web, visit
> >>>>http://groups.google.com/group/google-ajax-search-api?hl=en_US
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Google AJAX APIs" group.
> >>> To post to this group, send email to
> >>> [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> To view this message on the web, visit
> >>>http://groups.google.com/group/google-ajax-search-api?hl=en_US
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Google AJAX APIs" group.
> >>> To post to this group, send email to
> >>> [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> To view this message on the web, visit
> >>>http://groups.google.com/group/google-ajax-search-api?hl=en_US
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Google AJAX APIs" group.
> > To post to this group, send email to
> > [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > To view this message on the web, visit
> >http://groups.google.com/group/google-ajax-search-api?hl=en_US
> > For more options, visit this group at
> >http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
http://groups.google.com/group/google-ajax-search-api?hl=en_US
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

Reply via email to