1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    3
    Vote Rating
    0
    peter_n is on a distinguished road

      0  

    Default Basic Dialog, is this possible....

    Basic Dialog, is this possible....


    is it possible to have a link in a basic dialog and when you click on the link to have the dialog animate out before loading the new page into the browser?

    thanks
    Peter

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    62
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Yes. Add a Listener for "click" to the dialog's Element (getEl())

    In the handler, see if the event's target has a tagName of "a". If so, stop the event, hide the BasicDialog with animation, and set the document's href to the "a" element's href in the handler of the "hide" event.

    That's the recipe, now read the docs, and hack!

    http://www.yui-ext.com/docs/

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    39
    Vote Rating
    0
    gfraser is on a distinguished road

      0  

    Default


    Here's some code I've ripped from a dialog I'm working on...

    First, set up an event handler (in my case it will deal with clicks on addresses in an east panel):

    [code]
    // event handler for when a past address is clicked
    var addressClicked = function(e){
    var a = e.findTarget(null, 'a'); // find the "a" element that was clicked
    if (a) {
    e.preventDefault();
    ContactEditor.setAddress(pastAddresses[Number(a.href.split('$')[1])]);
    }
    };

    ....
    [code]

    Next, listen to your panel:

    [code]
    ....

    east = layout.add('east', new YAHOO.ext.ContentPanel(YAHOO.util.Dom.generateId(), {
    autoCreate: true,
    fitToFrame: true,
    autoScroll: true,
    title: 'Previous Addresses'
    }));

    layout.endUpdate();

    pastAddrPanel = east.getEl();
    pastAddrPanel.mon('click', addressClicked);
    [code]

    Any URL's clicked in that panel (a tags) will end up triggering the event listener shown earlier and that will stop the URL from being followed. From there you can do whatever you want

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    62
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I think a user would get pretty annoyed if clicking on a link waited for some animation to happen before being actioned. I wouldn't visit the site again. I'm impatient.

Similar Threads

  1. basic dialog
    By Alidad in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 21 Nov 2008, 7:22 AM
  2. Need Help In Basic Dialog
    By tagfrisk in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 1 May 2007, 11:28 PM
  3. basic dialog basic question
    By kevinknight in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 13 Mar 2007, 10:58 AM
  4. Very basic custom dialog
    By gfraser in forum Community Discussion
    Replies: 9
    Last Post: 8 Jan 2007, 3:37 PM
  5. help with Basic Dialog!
    By VatsaL in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 2 Dec 2006, 2:50 PM

Thread Participants: 2