-
16 Aug 2011 12:20 AM #1
How to call a function from a qtip?
How to call a function from a qtip?
Hi,
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?
Thanks,
Rob
Code: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ßen', handler: function () { winContext.hide() } }] }) } } // code in tree .... qtip: "<a href='#' onclick='metadata();'>Metadata</a> ...
-
16 Aug 2011 8:24 AM #2
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:
The function generates an Ext.Window subclass instance and then calls the show() method on that window.Code:<a href="#" onclick="App.utils.getDirections(' + d.strc_num.toString() + ',' + lat + ',' + lng + ');">Get Directions</a>
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:
Code:obj = new App.utils.Utility(config); obj.show();Last edited by kaendsle; 16 Aug 2011 at 8:28 AM. Reason: Clarity


Reply With Quote