PDA

View Full Version : Why my code does not work?



kww
25 Jun 2014, 5:51 PM
I am learning Ext JS 4 from http://www.extjs-tutorial.com/

W (http://www.extjs-tutorial.com/)hen I tried to run the following code from http://www.extjs-tutorial.com/extjs/viewport-in-extjs4


Ext.create('Ext.container.Viewport', {


id: 'SchoolViewport',


layout: {
type: 'border'
},
items: [
{
region: 'north',
margins: '0 0 5 0',
title:'Header (north region)',
height: 100,
html:'Header information goes here'
}, {
region: 'west',
title: 'Left bar (west region)',
width: 150,
html:'Navigation goes here'
}, {
region: 'south',
title: 'Footer (south region)',
html: 'Footer Information goes here',
height: 100

}, {
region: 'east',
title: 'Right bar (East region)',
width: 150,
html:'Important information goes here'
}, {
region: 'center',
title:'center content area (center region)',
html:'Content area'
}]
})


My browser does not show any thing.

As I have run other code in the tutorial thus I don't think it's from my constructing the application. I am wondering whether anyone else has my problem. Thanks!

Farish
26 Jun 2014, 2:47 AM
i tried it on FF and it worked. which browser are you using? try to debug using Firebug in FF or press F12 in IE or Chrome. see if you get any error message. one possible reason could be that the files are not found (wrong location for JS files).

kww
28 Jun 2014, 3:25 PM
I am using FF too. But it just does not work. When I run


xt.application({
name: 'extjs-tutorial.com',
launch: function () {
Ext.create('Ext.container.Viewport',
{
layout: 'fit',
items: [{
title: 'First ExtJS Application - Viewport title',
html: 'Hello'
}]
});
}
})

It works. However even if I run

Ext.Msg.alert('Status', 'Hello!')
It does not work; I mean there is no alert message.

Farish
30 Jun 2014, 3:46 AM
set a breakpoint and try to debug