Results 1 to 9 of 9

Thread: use jQuery objects in Ext classes

  1. #1
    Sencha User
    Join Date
    Feb 2010
    Location
    dp.ua
    Posts
    10

    Question use jQuery objects in Ext classes

    1) where JS code bb-tag??

    2) I'm using jQuery and Ext-jQuery adapter. For what this adapted needed if no possibility put jQuery objects into Ext classes?
    Code:
    // works
    var lMask = new Ext.LoadMask(Ext.get('tree'), {msg: '?????????, ????...'});
    // doesn't work
    var lMask = new Ext.LoadMask($('#tree'), {msg: '?????????, ????...'});

  2. #2
    Sencha User
    Join Date
    Feb 2010
    Location
    dp.ua
    Posts
    10

    Default

    Why adapter don't use smth like this:

    Code:
    (function($)
    {
    	$.fn.toExt = function()
    	{
    		//console.log(this);
    		return Ext.get(this[0]);
    	}
    
    	var oldExtGet = Ext.get;
    	Ext.get = function(el)
    	{
    		if (typeof el.jquery != 'undefined')
    			return el.toExt();
    
    		return oldExtGet(el);
    	}
    })(jQuery);
    ?

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    It would seem like a lot of overhead to wrap a DOM element with a jQuery object and then have to unwrap it build an Ext object around it. While jQuery $ and Ext.get both wrap DOM object, they are not equivalent.
    Ext.get('tree') != $('#tree') // where tree is DOM element.

    Doing that conversion back and forth on every operation would be expensive. The Ext object does pretty much the same thing as $, albeit with slighty different syntax. If you're really high on using the $ to reduce keystrokes, you could set $=Ext.get;

  4. #4
    Sencha User
    Join Date
    Feb 2010
    Location
    dp.ua
    Posts
    10

    Default

    I don't want override "$". There are too much differences with Ext.get and $ usage
    http://matthiasschuetz.com/javascrip.../en/dom-basics

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    If you truly think that the term "css" indicates to future maintainers of your code (who may be violent psychopaths who know where you live) the intention of your code better than "setStyle", then you can very easily set that method to be equivalent.

    Code:
    Ext.CompositeElementLite.prototype.css = function() {
        this.invoke("setStyle", arguments);
    };

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Is that your site, http://matthiasschuetz.com/javascrip.../en/dom-basics ?

    That's very cool, kind of a rosetta stone for Ajax foundation libraries. I think a link to that from Ext's Learning page is needed, that will help out people with crossover.

  7. #7
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

  8. #8
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    I don't think it's his site, as the author of the site is german but Koc seems to be russian.

    You can't mix jquery and ExtJS. Using the adapter means that you can use jQuery or ExtJS side by side.
    But in ExtJS method there is no way using jQuery functions.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  9. #9
    Sencha User
    Join Date
    Feb 2010
    Location
    dp.ua
    Posts
    10

    Default

    Quote Originally Posted by Animal View Post
    Is that your site, http://matthiasschuetz.com/javascrip.../en/dom-basics ?

    That's very cool, kind of a rosetta stone for Ajax foundation libraries. I think a link to that from Ext's Learning page is needed, that will help out people with crossover.
    oh, no, I've just finded this site by Google .

    steffenk, yes, I'm from Ukraine.

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
  •