PDA

View Full Version : Why no reference to BLANK_IMAGE_URL in my examples?



srn
7 May 2010, 11:21 AM
I am new to Ext JS, going through tutorials and stuff.

The online tutorials insist that the first lines need to include:
Ext.BLANK_IMAGE_URL = '../extjs/resources/images/default/s.gif';
Ext.onReady(function(){
...

The onReady waits to see that the image has been loaded before executing any code.

So why, when I look through all the examples in my dev folder, do I not see the BLANK_IMAGE_URL line?

For example, I'm looking at ext-3.2.1\examples\spinner\spinner.html. It calls these files:
"../../adapter/ext/ext-base.js"
"../../ext-all.js"
"../ux/Spinner.js"
"../ux/SpinnerField.js"
"spinner.js"

I would expect to see Ext.BLANK_IMAGE_URL = '../extjs/resources/images/default/s.gif';in spinner.js but it is not there. It simply starts right in the with the onReady test:
/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* [email protected]
* http://www.extjs.com/license
*/
Ext.onReady(function(){

What am I missing? Is this possibly a change in functionality with v3.2.1?

CrazyEnigma
7 May 2010, 11:32 AM
If you don't set this properly, you will see image artifacts in your display.

Ext is a Singleton, that contains a reference to the Blank Image of s.gif. You need to locate this s.gif relative to your html page. Check out the API on Ext, and you will see that BLANK_IMAGE_URL is there. Where is it in code, it is probably in ext-base.js. ext-base is the "minified" version of the extjs library.

If you want to see this in code, then open ext-base-debug.js.

Hope this answers your question.

srn
7 May 2010, 11:41 AM
Check out the API on Ext, and you will see that BLANK_IMAGE_URL is there. Where is it in code, it is probably in ext-base.js. ext-base is the "minified" version of the extjs library.

If you want to see this in code, then open ext-base-debug.js.

Yes, I've been looking for it. The only place I've found it defined is here line 549 in ext-base-debug:

Ext.apply(Ext, function(){
.....
..return {
..emptyFn : function(){},
....BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
....'http:/' + '/www.extjs.com/s.gif' :
....'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
.......

So, is that it? (though the function is called apply, not onReady).

I guess I'm sensing that the tutorials are sort of barebones? You need that reference, so they've included it explicitly in their online samples, but when using the examples in the dev framework, it's taken care of for me. Is that right?

httpdotcom
7 May 2010, 12:33 PM
It isn't set in the dev examples because it automatically is set to extjs.com/s.gif, unless you override it. They have no need to override it, so they didn't set it.

srn
7 May 2010, 12:48 PM
I see. Thanks.

Still not sure why the online examples do have that line if it's not needed. Oh I see - that's why you're referring to them as singlets - i.e. that the online examples are effectively standalone, and do not sit on top of ext-base and ext-all.

evant
7 May 2010, 9:22 PM
In most browsers, the "s.gif" isn't required, because it's included as a data url. It's only for IE6/7, IIRC.