Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41

Thread: jQuery equivalent

  1. #21
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Answers
    4
    Vote Rating
    9
      0  

    Default

    btw - i really like the $(), so this can be done also:
    var $ = Ext.select;

    Why isn't that used in ExtJS? Many newcomers know that from the other libraries.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #22
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,607
    Answers
    15
    Vote Rating
    59
      0  

    Default

    Quote Originally Posted by evant View Post
    A filter method that accepts a function would be good. I'm playing around with some code now:

    Code:
    Ext.onReady(function(){
        for(var i = 0; i < 10; ++i){
            Ext.getBody().createChild({
                tag: 'div',
                cls: i % 2 == 0 ? 'foo' : 'bar'
            });
        }
        console.log(Ext.select('div').filter('.foo').getCount());
        console.log(Ext.select('div').filter(function(el){
            return el.is('.foo');
        }).getCount());
    });
    Obvoiusly both return the same results.
    That's good. What about maintaining functional parity with jQuery with those other things? nextAll and andSelf were pretty easy to add in. If there are any others, they could go in too.

    I also think the ability to add pseudos should be highlighted in the "textual" Core Manual.

    The following is an intuitive way of selecting external links:

    Code:
    Ext.select("a:external");

  3. #23
    Sencha User
    Join Date
    Aug 2009
    Posts
    41
    Vote Rating
    0
      0  

    Default

    PHP Code:
    $('body').removeClass(); 
    How to remove all classes from body (for example) in Ext?

  4. #24
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Answers
    28
    Vote Rating
    11
      0  

    Default

    Quote Originally Posted by Dig4Fire View Post
    PHP Code:
    $('body').removeClass(); 
    How to remove all classes from body (for example) in Ext?
    PHP Code:
    document.body.className ''
    For some things you just dont need a library hehe. Please lets not forget we are still doing Javascript development, and doing things as trivial as this should really be straightforward for any developer using javascript.

  5. #25
    Sencha User
    Join Date
    Aug 2009
    Posts
    41
    Vote Rating
    0
      0  

    Default Remove an event handler

    PHP Code:
    $(document).ready(function() {
      $(
    '#switcher').click(function(event) {
        if (!$(
    event.target).is('.button')) {
          $(
    '#switcher .button').toggleClass('hidden');
        }
      });
      
      $(
    '#switcher-narrow, #switcher-large').click(function() {
        $(
    '#switcher').unbind('click');
      });
    }); 
    How to remove (unbind) the event handler in Ext?

    This code doesn't work:
    PHP Code:
        Ext.select('#switcher').un('click'this.handlerFn); 

  6. #26
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Answers
    28
    Vote Rating
    11
      0  

    Default

    PHP Code:
    Ext.onReady(function() {
      var 
    handlerFn = function(ev) {
        if (!
    ev.getTarget('.button')) {
          
    Ext.select('.button''switcher').toggleClass('hidden');
        }
      }

      
    Ext.fly('switcher').on('click'handlerFn);
      
      
    Ext.select('#switcher-narrow, #switcher-large').on('click', function() {
        
    Ext.fly('switcher').un('click'handlerFn);
      });
    }); 

  7. #27
    Sencha User
    Join Date
    Aug 2009
    Posts
    41
    Vote Rating
    0
      0  

    Default Event Namespacing

    Thank you. What about Event Namespacing to manage specific event handlers?
    PHP Code:
    $(document).ready(function() {
      $(
    '#switcher').bind('click.collapse', function(event) {
        if (!$(
    event.target).is('.button')) {
          $(
    '#switcher .button').toggleClass('hidden');
        }
      });
      
      $(
    '#switcher-narrow, #switcher-large').click(function() {
        $(
    '#switcher').unbind('click.collapse');
      });
    }); 

  8. #28
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,607
    Answers
    15
    Vote Rating
    59
      0  

    Default

    What does using an event name like "click.collapse" mean?

  9. #29
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
      0  

    Default

    jQuery uses event namespaces to filter bindings. Event namespaces work like this: ("type.namespace"). This link explains it: http://www.learningjquery.com/2007/0...ce-your-events

    I haven't personally had a situation where this functionality is useful.

  10. #30
    Sencha User
    Join Date
    Aug 2009
    Posts
    41
    Vote Rating
    0
      0  

    Default

    The .collapse suffix is invisible to the event handling system. The addition of the namespace means that you can unbind just this handler. Event namespacing is especially handy in the creation of plugins.

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

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