1. #1
    Sencha User
    Join Date
    Aug 2007
    Posts
    89
    Vote Rating
    0
    Cyberangel67 is on a distinguished road

      0  

    Default Unanswered: Is this even possible create element and listening and fire event?

    Unanswered: Is this even possible create element and listening and fire event?


    I am looking at creating something like this in ExtJS, it seems that jQuery has a very nice handy feature here.

    http://www.bennadel.com/blog/1998-Us...-DOM-Nodes.htm

    When I write the code like this, I get a weird error.

    uncaught exception: Error listening for "ping". Element "undefined" doesn't exist.

    The code is

    Code:
    			freeNode = new Ext.Element('div');
    			freeNode.on('ping', function() {alert('You pinged me');});
    Anyone have any ideas on how to achieve this?

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

      0  

    Default


    But do you really NEED an element?

    If you just want to fire events from SOMETHING, instantiate an Observable.

    Code:
    var myComponent = new Ext.util.Observable();
    myComponent.on('ping', function(){alert("ping");})
    myComponent.fireEvent("ping");

  3. #3
    Sencha User
    Join Date
    Aug 2007
    Posts
    89
    Vote Rating
    0
    Cyberangel67 is on a distinguished road

      0  

    Default


    Thanks Animal, I sort of figured I could do that. I was curious on more of whether one could create an element that was detached from the DOM and still be able to apply events to it.

    Come to think of it I am not even sure of a good case that one would need too.

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

      0  

    Default


    There is no use case.

    That blog post is just ignoring the heffalump in the room, that jQuery has no Observable base class!

Similar Threads

  1. Textfield event listening
    By alupuli in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 24 Feb 2010, 4:32 PM
  2. Fire event on element
    By TrickOfTheMind in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 28 Apr 2008, 7:23 AM
  3. Listening to an Element inside an iframe (MINI-GUIDE)
    By Neo in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 23 Aug 2007, 2:05 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar