PDA

View Full Version : Newbie question on ext.application and ext.onready



hwmaat
30 Jun 2012, 1:27 AM
Absolute beginner here, trying to start with ext.js. Hard to find some overview of the steps to take for creating a simple application.
Want to create a simple address manager application with basic crud operations that opens with a list view of the addresses and has add/edit/delete buttons on a toolbar. The add/edit options should popup an edit form with the proper input fields.
Could someone explain me when to use Ext.appplication and when to use ext.onReady? And when should I use Ext.container.Viewport?

option 1, using ext.application

Ext.application({
name: 'HelloExt',
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}
});

Option 2; using Ext.onReady

Ext.onReady(
function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}
);

evant
30 Jun 2012, 1:36 AM
1) If you're using MVC, use launch, if not, use onReady

2) The viewport fills the whole screen automatically, so use that if your page will take up the whole page.

hwmaat
1 Jul 2012, 1:00 AM
Thanks, that clears things up. One last question. in option 1 I use ext.application, in option 2 I do not use it. And in both cases it works.
When should I use ext.application?

hwmaat
1 Jul 2012, 1:02 AM
Forget my provious question, it's clear now.