PDA

View Full Version : Why won't the following code work?



JacobGu
18 Feb 2011, 10:02 AM
With the following code, all that renders is a toolbar at top that says "My Bottom Bar". There is not "Initializing..." text displayed, nor does the app take up entire window. How do I get true fullscreen, the panel text to render, and toolbar at bottom? Thanks

index.html:

<!DOCTYPE html>
<html>
<head>
<title>TC</title>
<script type="text/javascript" src="lib/touch/sencha-touch-debug.js"></script>
<link href="lib/touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="app/app.js"></script>

<script type="text/javascript" src="app/views/Viewport.js"></script>
<script type="text/javascript" src="app/views/Splash.js"></script>
</head>
<body></body>
</html>

app/app.js:

Ext.regApplication('TC', {
name : 'TC',

launch: function() {
this.views.viewport = new TC.views.Viewport();
}
});

app/views/Viewport.js:

TC.views.Viewport = Ext.extend(Ext.Panel, {
fullscreen: true,
layout: 'card',
cardSwitchAnimation: 'slide',
initComponent: function() {
//put instances of cards into app.views namespace
Ext.apply(TC.views, {
splash: new TC.views.Splash()
});
//put instances of cards into viewport
Ext.apply(this, {
items: [
TC.views.splash
]
});
TC.views.Viewport.superclass.initComponent.apply(this, arguments);
}
});

app/views/Splash.js:

TC.views.Splash = Ext.extend(Ext.Panel, {

styleHtmlContent: true,
items: [{
html: 'Initializing...',
height: 200,
}],
dockedItems: [{
xtype: 'toolbar',
title: 'My Bottom Bar',
dock: 'bottom',
fullscreen: true,
}],
initComponent: function() {
TC.views.Splash.superclass.initComponent.apply(this, arguments);
}
});

JacobGu
18 Feb 2011, 10:38 AM
After some more twiddling my code around, I discovered I can get the correct display by using Ext.setup instead of Ext.regApplication. What exactly is the purpose of the different functions? Is regApplication a more buggy function at this time?

JacobGu
18 Feb 2011, 11:00 AM
After rolling back from 1.0.1 to 1.0 (as some other bloggers suggested), regApplication in my original example works just fine. How can it be, though, that 1.0.1 is the latest release for over 2 months with MVC broken? From Sencha videos and tutorials, it seems like Sencha is pushing MVC as "the" way to develop Sencha applications, and yet the latest release doesn't support it.