PDA

View Full Version : Linking map InfoWindow to Sencha function



MrBeef
14 Apr 2012, 10:08 AM
Hi all,

I'm trying to place a link in a Google Maps InfoWindow that, when clicked, performs a function in Sencha Touch. Specifically, when clicked, I want to switch to another tab and populate a form.

My function to perform the tab switch (this will also populate a form):


function windowLink()
{
tabs.setActiveItem(2);
}


Then in my InfoWindow content variable I create the following link, but it doesn't seem to work when clicked. I've also tried using the onclick property but with no luck. I would appreciate any suggestions, thanks!



var content = "<a href=\"javascript:windowLink();\">some text</a>";

ci11111
15 Apr 2012, 2:57 AM
not sure it's the best solution
but you will have to put outside Ext.application
var windowLink ;

then inside your app:


windowLink = function()
{
tabs.setActiveItem(2);
}

and finally in your infowindow:
'<a href="javascript:windowLink();">some text</a>'

MrBeef
15 Apr 2012, 8:07 AM
That works! I guess it must be a variable scope issue.