Results 1 to 2 of 2

Thread: How to call a function from a qtip?

  1. #1
    Sencha User
    Join Date
    Sep 2010

    Default How to call a function from a qtip?


    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 doesnt 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>

  2. #2
    Sencha User
    Join Date
    Nov 2010


    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);         
    Last edited by kaendsle; 16 Aug 2011 at 8:28 AM. Reason: Clarity

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts