1. #1
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,407
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default ExtJS debugging help in Firebug

    ExtJS debugging help in Firebug


    In order to see this in Firebug (that is, instead of all the "Object {}" descriptions for objects, you instead get "Ext.Element {}", etc.):



    Insert this after ext-all-debug.js:

    PHP Code:
    (function(){
        if (!
    Ext.isGecko)
        {
            return;
        }
        var 
    cache={},depth=0;
        function 
    setToString(fn,name){
            if (
    typeof cache[name.toLowerCase()] == 'undefined')
            
    fn.prototype.toString = function(){
                return 
    name;
            }
        }
        function 
    walker(start,lookFor,parent)
        {
            if (
    depth >12) return;
            
    depth++;
            
    lookFor lookFor ||"override";
            
            
    parent parent || '';
            if (
    start == window)
                return;
            for (var 
    name in start) {
                try {
                    var 
    current start[name];
                    if (
    typeof current === 'object' && name !== 'prototype' && current && !(current instanceof Node) && !current.firebug && typeof current.length === 'undefined' && Ext.Component && Ext.ComponentMgr.all != current && Ext.ComponentMgr.types != current) {
                        
    walker(current,lookFor,parent '.' name);
                    }
                    else if (
    name !== 'constructor' && typeof current === 'function' && current.prototype && (typeof current.prototype.superclass == 'object' || typeof current.prototype[lookFor] == 'function')) {
                        
    setToString(current,parent '.' name);
                    }
                } catch (
    e) {}
            }
            
    depth--;
        }
        
    Ext.toString=function(){return 'Ext ' Ext.version;}
        
    setToString(Ext.Element,'Ext.Element')
        
    setToString(Ext.util.Observable,'Ext.util.Observable')
        
    setToString(Ext.util.DelayedTask,'Ext.util.DelayedTask')
        
    setToString(Ext.util.TaskRunner,'Ext.util.TaskRunner')
        
    setToString(Ext.util.Event,'Ext.util.Event')
        
    setToString(Ext.LoadMask,'Ext.LoadMask')
        
    setToString(Ext.Shadow,'Ext.Shadow')
        
    setToString(Ext.Error,'Ext.Error')
        
    setToString(Ext.Action,'Ext.Action')
        
    setToString(Ext.Template,'Ext.Template')
        
    walker(Ext,'Ext');
        
    Ext.util.MixedCollection.prototype.toString = function(){
            var 
    len this.length || 0;
            return 
    "Ext.util.MixedCollection [ " len +" items ]";
        }
        
    Ext.override(Ext.Component,{
            
    toString:function(){
                return 
    this.xtype 'xtype '+this.xtype 'ctype ' this.ctype;
            }
        })
    })(); 
    Reference: original discussion.
    Last edited by stever; 4 May 2010 at 6:13 PM. Reason: Added MixedCollection special case

  2. #2
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    Great - thank you very much for sharing.

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2009
    Posts
    239
    Vote Rating
    2
    stephen.friedrich will become famous soon enough

      0  

    Default


    Hm, the walker does not seem to work for me (it never calls setToString() for any classes).
    I did include the file after including ExtJS 3.1.1.

    I only get the "hardcoded" stuff like Ext.Element and Ext.util.Observable, but nothing else (for example Ext.data.Record is missing).

  4. #4
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,407
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    Quote Originally Posted by stephen.friedrich View Post
    Hm, the walker does not seem to work for me (it never calls setToString() for any classes).
    I did include the file after including ExtJS 3.1.1.

    I only get the "hardcoded" stuff like Ext.Element and Ext.util.Observable, but nothing else (for example Ext.data.Record is missing).
    Strange. Did you try single stepping to see what is going on?

  5. #5
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,407
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    One other addition I found helpful:

    PHP Code:
        Ext.util.MixedCollection.prototype.toString = function(){
            var 
    len this.length || 0;
            return 
    "Ext.util.MixedCollection [ " len +" items ]";
        } 
    It is a nice quick look inside to see how many items a mixed collection has.

Thread Participants: 2

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