PDA

View Full Version : Basic book sample doesn't work, no autoload



febus
30 Aug 2009, 2:32 PM
Hello,
I'm trying the very first sample from book "Ext JS in action" by Jesus Garcia.
The whole sample helloWorld.html can be found at http://extjsinaction.com/examples/chapter01/
If I copy all files to my computer, then set path to extjs library correctly, then I can see the new extjs window in my browser. But, I can't see any content in extjs window which should be sayHi.html, only "Loading...". Looks like sayHi.html could not be found. What I'm doing wrong? Why does this sample work, if I start it from the link above directly?


function buildWindow() {


var win = new Ext.Window({
id : 'myWindow',
title : 'My first Ext JS Window',
width : 300,
height : 150,
layout : 'fit',
autoLoad : {
url : 'sayHi.html',
scripts : true
}
});
win.show();
}

Ext.onReady(buildWindow);

evant
30 Aug 2009, 4:48 PM
You need to run it through a web server, if you aren't already.

febus
31 Aug 2009, 12:56 PM
You need to run it through a web server, if you aren't already.

Yes, it helps, if I start it through my web server. Thank you! :)
If I start it from windows explorer with a double click on file, I see in debugger that I have not enough rights for opening sayHi.html.(Access denied) Why web server is needed? Actually I have no server side code at all, it stays the whole time on the client side?

carol.ext
31 Aug 2009, 1:25 PM
So, what is autoload doing?

steffenk
31 Aug 2009, 1:30 PM
autoload loads content from url - this means it request the file not from file system but from webserver, eg
http://[domain]/[autoload-url property]

This request can only be handled by a webserver.

febus
31 Aug 2009, 1:45 PM
Good question, what autoload does? I didn't ask me before :)
Ok, I've got it now, I think.
autoload call Ext.Updater.update method.
Documentation tells about this method:
* Performs an asynchronous request, updating this element with the response.
* If params are specified it uses POST, otherwise it uses GET.

So, if I send a request, someone should give a response. It means I need a server. :)
Thank you! :)

jay@moduscreate.com
15 Oct 2009, 5:04 AM
I'll try to find the time to update the text to include the fact that a web server is required.