PDA

View Full Version : How to find things in the documentation



Troy Wolf
7 Sep 2007, 7:55 AM
Before I sound like I'm complaining, let me say that Ext is wonderful. The documentation is very good and even the documentation viewer is beautiful.

I have to admit (as I have in a few other threads), I'm struggling with Ext. I'm making progress, but I'm struggling. Let's just say "Extra-Strength Excedrin" has been my study partner.

Right now I am beating my brain trying to figure out how to process the JSON returned by my server on an Ext form submit. (I don't even know how to access it.) But let's forget about that for now....let's take a step back and look at a larger, more basic issue...

So I look at code like this:

frmTweak.addButton('Apply', function() {
if (frmTweak.isValid()) {
frmTweak.submit({
params:{action:'Tweak'},
waitMsg:'Processing data, please wait...',
reset:false,
scope:frmTweak,
success: function() {alert('success');}
});
} else {
Ext.MessageBox.alert("Warning", "Please correct missing or invalid fields.");
}
});
I can see that an Ext Form named frmTweak has been created (not in this snippet). I can see that if the form isValid(), we'll call the form's submit() method. I can see that the submit method takes an options object. I can see that one of the options is "success". I want to know more about this option...

So off to the docs I go. I start by going to the Form docs:
http://extjs.com/deploy/ext/docs/output/Ext.form.Form.html
I scroll down and find the submit() method. I click it:
http://extjs.com/deploy/ext/docs/output/Ext.form.Form.html#submit
This only confirms that yes, the submit method does accept an options object. It tells me nothing about those options. It does, however, direct me to the doAction() function:
http://extjs.com/deploy/ext/docs/output/Ext.form.BasicForm.html#doAction
The doAction documentation tells me nothing about an option named "success".

This is one specific scenario, but this happens to me often. It may be easy for me to give up with "this Ext documentation is not very good", but I know enough to know I don't know enough! ;) The documentation is probably fantastic, but I need a primer in how to find what I'm looking for.

My suspicion is that the submit action (or the form) is inheriting from (or extending?) some more basic object that defines the success option. But when top-down learning from code examples, how would or could I know that?

I am ready to be schooled (or shamed as it may be).

Animal
7 Sep 2007, 8:20 AM
The documentation is sparse in this area.

If it's calling your success function, best thing is to put its code in a seperate line so that you can set a Firebug breakpoint there, then break there.

Then put "arguments" - don't include the quotes into your inspection tab, and see what args are passed.

You can also step bck through the call chain to see what's called you and what it has passed you.

Troy Wolf
7 Sep 2007, 9:32 AM
Thanks again, Dr. Cox. (http://en.wikipedia.org/wiki/Perry_Cox)

So in this case, I'm not finding the details because they are not there. I guess that makes me feel better.

Obviously the documentation will only get more complete over time. What would help me (and probably others) even more than expanding the documentation is more example snippets with working examples (where applicable).

Firebug is my friend.