View Full Version : How to call a function from a qtip?

16 Aug 2011, 12:20 AM

I am simply trying to call a function from a qtip. The function should open an ext.window and display html. Nothing complicated, but it doesn´t work.

Cann anyone tell me how to achieve this?



function metadata() {
if (!winMetadata) {
var node = treePanel.getSelectionModel().getSelectedNode();
var layername = node.text;
var winMetadata = new Ext.Window({
title: '<span style="color:#00; font-weight:bold;">Metadaten: </span>' + layername,
layout: 'fit',
text: layername,
width: 800,
height: 500,
closeAction: 'hide',
plain: true,
items: [ct],
buttons: [{
text: 'Schlie&szlig;en',
handler: function () {

// code in tree
qtip: "<a href='#' onclick='metadata();'>Metadata</a>

16 Aug 2011, 8:24 AM
I don't have experience doing this inside a QuickTip pop-up, but I believe you can achieve the desired result wherever HTML is allowed by simply writing event handling into an anchor.

For example, I have a Google Maps API web application that includes a directions utility (ExtJS Window) accessible through a link in any marker's pop-up InfoWindow. I just call a function (App.utils.getDirections) when the link is clicked:

<a href="#" onclick="App.utils.getDirections(' + d.strc_num.toString() + ',' + lat + ',' + lng + ');">Get Directions</a>

The function generates an Ext.Window subclass instance and then calls the show() method on that window.

EDIT: I realize you have implemented what I suggested so far, and I think the problem is in your metadata() function. I think the problem is that you are instantiating a window called winMetadata but you aren't calling the show() method on it. The business-end (and end of the function) of my equivalent getDirections() function does just that:

obj = new App.utils.Utility(config);