ExtJS 4 "Hello World" Application Using Ext Loader

Posted By Vitaliy | April 30, 2017 | ExtJS 4.0.0
0 275
The idea is to include only the core of ExtJS - ext.js file (148 Kb) instead of ext-all.js file (1028 Kb) and to load only necessary (for your app) classes specified by require statements.
You can find more details here.
To understand how to avoid using of Loader see my another post.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<link  href="/ext/4.0.0/resources/css/ext-all.css" rel="stylesheet" />
		<script src="/ext/4.0.0/ext.js"></script>
		<script>
			Ext.Loader.setConfig({
				enabled : true,
				paths: {
					Ext: '/ext/4.0.0/src'
				}
			});
		</script>
	</head>
	<body>
		<script>
			Ext.require('Ext.window.MessageBox');
			Ext.onReady(function() {
				Ext.Msg.alert('Welcome', 'Hello, World!');
			});
		</script>
	</body>
</html>

Js Code

Ext.require('Ext.window.MessageBox');
Ext.onReady(function() {
    Ext.Msg.alert('Welcome', 'Hello, World!');
});
            

ExtJS 4 "Hello World" Application

Posted By Vitaliy | April 30, 2017 | ExtJS 4.0.0
0 262
This is minimal html page code to run ExtJS version 4.
Note: that it's recommended to add strict DOCTYPE for this version of library.
Also there is a way to avoid including of whole ExtJS library (ext-all.js, 1028Kb). You can find demo in my another post and more details here.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<link href="/ext/4.0.0/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
		<script src="/ext/4.0.0/ext-all.js"></script>
	</head>
	<body>
		<script>
			Ext.onReady(function() {
				Ext.Msg.alert('Welcome', 'Hello, World!');
			});
		</script>
	</body>
</html>

Js Code

Ext.onReady(function() {
    Ext.Msg.alert('Welcome', 'Hello, World!');
});