arlo.carreon
7 Jul 2010, 9:33 AM
I am showing property listings on a map. When a user clicks on a marker, I show a panel with the following carousel.
// Carousel for properties
propertyCarousel = new Ext.Carousel({
defaults: {
cls: 'card',
scroll: 'vertical'
},
items: [/*cards are loaded dynamically, via JSONP callback.*/]
});
I load the cards into the carousel when I plot the markers on the map. When the user clicks a marker, I want the carousel to show the card that CORRESPONDS with the marker that was clicked on.
Here is my listener:
// click listener for markers
google.maps.event.addListener(marker, 'click', function(){
// Show the property popup panel
propertyWindow.show();
// Loop through search results until you find the one that was clicked on
var found = false;
do{
if( propertyCarousel.getActiveItem().position == data.position )
found = true;
else
{
// Determine whether to move forward or backward on the list
if( propertyCarousel.getActiveItem().position < data.position )
propertyCarousel.next();
else
propertyCarousel.prev();
}
}while(!found)
});
Actual Problem:
This works halfway. The carousel pages are turned to the correct page (I can tell by the carousel indicator), but the visual card is not on the correct page. When I happen to click (anywhere) on the carousel, THEN the carousel zooms to the correct page. I so not know if I am missing some sort of fireEvent() or something.
Let me know if you need more information.
// Carousel for properties
propertyCarousel = new Ext.Carousel({
defaults: {
cls: 'card',
scroll: 'vertical'
},
items: [/*cards are loaded dynamically, via JSONP callback.*/]
});
I load the cards into the carousel when I plot the markers on the map. When the user clicks a marker, I want the carousel to show the card that CORRESPONDS with the marker that was clicked on.
Here is my listener:
// click listener for markers
google.maps.event.addListener(marker, 'click', function(){
// Show the property popup panel
propertyWindow.show();
// Loop through search results until you find the one that was clicked on
var found = false;
do{
if( propertyCarousel.getActiveItem().position == data.position )
found = true;
else
{
// Determine whether to move forward or backward on the list
if( propertyCarousel.getActiveItem().position < data.position )
propertyCarousel.next();
else
propertyCarousel.prev();
}
}while(!found)
});
Actual Problem:
This works halfway. The carousel pages are turned to the correct page (I can tell by the carousel indicator), but the visual card is not on the correct page. When I happen to click (anywhere) on the carousel, THEN the carousel zooms to the correct page. I so not know if I am missing some sort of fireEvent() or something.
Let me know if you need more information.