PDA

View Full Version : Class names when inspecting Ext instances



TheBerliner
25 Aug 2009, 11:25 PM
I am still farily new to JS and EXT and I am wasting very much time, because neither Firebug nor DomInspector give any information about the class of the inspected instances.

I really don't understand why this most important information is not shown (in most cases, in some few it is shown). In the o-o dev environments that I know this is taken for granted (and a lot more, too). How can JS developers work without this?!!!

Is there any trick that I don't know yet to tell these tools to show this most essential information?

All my searching on this subject was in vain so far.

Thank you for any hint!

Condor
25 Aug 2009, 11:38 PM
It's a problem of javascript in general.

Ext solves the problem for Components by defining an xtype in the constructor, e.g.

console.log(comp.constructor.xtype);

(but this only works for components and descendants and not for other classes)

steffenk
25 Aug 2009, 11:40 PM
i think you don't know how to inspect right?

Have a look to the videos of Jay, he does most in firebug:
http://tdg-i.com/category/extjs/ext-and-javascript-screencasts

Short example: Type this in firebug console on a page where ExtJS is included:
a = new Ext.DatePicker({});
then press ctrl + return, you should see something like this in console:

>>> a = new Ext.DatePicker({})
Object initialConfig=Object events=Object id=ext-comp-1009

Click on the "Object" link and you can inspect.

TheBerliner
26 Aug 2009, 12:52 AM
It's a problem of javascript in general.
My sincere condolences!

I almost thought so, just didn't wanna believe it!


i think you don't know how to inspect right?
Well, Steffen, danke sehr for your reply!

Of course I know "how to inspect". It's just that the minimal info is missing. For the last >20 yrs I have been using an environment, which 20 yrs ago was already lightyears ahead from today's JS. More here (http://extjs.com/forum/showthread.php?p=378968#post378968) and in the initial post by another Smalltalker.



Have a look to the videos of Jay, he does most in firebug:
http://tdg-i.com/category/extjs/ext-and-javascript-screencasts

I looked at this film but I cannot see where this shows the class name in Firebug and/or DomInspector.

Of course, I know the console. But it's - pardon me - a ridicilous idea to type some code into the console just to find out the class or every object in the hierarchy. This is not feasible timewise. Productivity is already extremely low in JS. And once that one has found out the class it takes ages to get the protocols how to access it. Just awful!

It is bad enough that one does not have a class browser like this here in Joose (http://it.test.avantaxx.de/xssinterface/projects/Joose/examples/class_browser.html) to at least find the protocols (methods). Much worse is that not even the most basic info, the class names, are not shown (in most cases). How can one work without this?!

Working in JS under these conditions is a nightmare!

But again thank you for your indirect confirmation that there really is not more available. The editors that I looked at incl. Aptana are just a bad joke! What a (JS) world?!?!

P.S. Such a class browser like in Joose would be a great enhancement for EXT JS. This has been standard in Smalltalk since the early 80-ies! Add some very much better documentation into this class browser and this would already be a great step ahead.

madamut
27 Aug 2009, 5:48 AM
I understand your frustration, I've gone through the same coming from a Java background.

The fact is that JS is a lot different than Java. After a couple of months of work with Javascript I got to the point where I actually like it now and it kinda feels natural to work with it. Although Javascript lacks things that Java has it certainly has some things that Java doesn't have which are quite fun to use :)

For me the real breakthrough in understanding Javascript came after reading the "JavaScript: The Definitive Guide" by Flanagan.
http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/0596101996/ref=sr_1_1?ie=UTF8&s=books&qid=1251379871&sr=8-1

Another thing that helped me a lot was looking at the ExtJS source and trying to understand how it works. I learned (and still learning) from that how things work and how should I write code myself.