Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default bind a clas to a function

    bind a clas to a function


    Hello !

    Can i bind a class to a function like JQuery ?

    Code:
    $(".mole").bind('click',function(e){
               ...         
     });
    Your sincerly

    Stephan

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    Cambridge, UK
    Posts
    164
    Vote Rating
    0
    Uberdude is on a distinguished road

      0  

    Default


    As I don't know jQuery I'm going to make an educated guess what that code does, please correct me if I am wrong: it selects all elements with the css class 'mole' and then attaches the specified function as an event listener to all of those elements for the 'click' event.

    Maybe you can do something similar in Ext with DomQuery. However, when I'm using Ext I'm rarely selecting and manipulating html elements (or indeed their Ext wrapper Ext.Element) directly. Instead I operate at the Ext.Component level, for which observeClass does a similar thing:

    Code:
    Ext.util.Observable.observeClass(Acme.widget);
    Acme.widget.on('click', function() {
        ...
    });
    This adds a click event listener to all instances of Acme.widget.

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default bind event to css class

    bind event to css class


    Hello !

    Thanks for the quick answer.
    In the moment i test Ext.DomQuery and the Ext.util.Observable.

    Here is my first test.
    But the test don't work.

    Code:
    var test = Array();
                    test = Ext.DomQuery.select('div[class=mole]');
                    Ext.util.Observable.observeClass(test);
                    test.on('click',function(){
                        alert('click');
                    })
    Have you an idea ?

    Greetings

    Stephan

  4. #4
    Sencha User
    Join Date
    Oct 2009
    Location
    Cambridge, UK
    Posts
    164
    Vote Rating
    0
    Uberdude is on a distinguished road

      0  

    Default


    Code:
    Ext.util.Observable.observeClass(test);
    You can't do this, observeClass should take a class (constructor function) as a parameter, but you are passing it an array! There are 2 separate approaches, if you want to use elements, use DomQuery to grab them, then iterate them and add your event listener. If you want to use components, use observeClass.

    As an aside 'var test = Array();' is pointless (and I always use the array literal [] anyway), just do 'var test = Ext.DomQuery...'

Thread Participants: 1