X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/f5240829880f87e0cf581c6a296e436fdef0ef80..refs/heads/master:/examples/init.js diff --git a/examples/init.js b/examples/init.js index 06f16dd1..051dde89 100644 --- a/examples/init.js +++ b/examples/init.js @@ -1,76 +1,90 @@ -/*! - * Ext JS Library 3.3.0 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license - */ +/* + +This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. + +*/ Ext.ns('Ext.samples'); (function() { -SamplePanel = Ext.extend(Ext.DataView, { - autoHeight : true, - frame : true, - cls : 'demos', - itemSelector : 'dd', - overClass : 'over', - tpl : new Ext.XTemplate( - '
', - '', - '

{title}

', - '
', - '', - '
', - '

{text}', - '', - ' (New)', - '', - '', - ' (Updated)', - '', - '', - ' (Experimental)', - '', - '

{desc}

', - '
', + Ext.define('Ext.samples.SamplePanel', { + extend: 'Ext.view.View', + alias: 'widget.samplepanel', + autoHeight : true, + frame : false, + cls : 'demos', + itemSelector : 'dl', + overItemCls : 'over', + trackOver : true, + tpl : Ext.create('Ext.XTemplate', + '
', + '', + '

{title}

', + '
', + '', + '
', + '

{text}', + '', + ' (New)', + '', + '', + ' (Updated)', + '', + '', + ' (Experimental)', + '', + '

{desc}

', + '
', + '
', + '
', '
', - '
', - '
', - '
', { - isExperimental: function(status){ - return status == 'experimental'; - }, - isNew: function(status){ - return status == 'new'; - }, - isUpdated: function(status){ - return status == 'updated'; - } - }), - - - onClick : function(e){ - var group = e.getTarget('h2', 3, true); - if(group){ - group.up('div').toggleClass('collapsed'); - }else { + '', { + isExperimental: function(status){ + return status == 'experimental'; + }, + isNew: function(status){ + return status == 'new'; + }, + isUpdated: function(status){ + return status == 'updated'; + } + }), + + onContainerClick: function(e) { + var group = e.getTarget('h2', 3, true); + + if (group) { + group.up('div').toggleCls('collapsed'); + } + }, + + onItemClick : function(record, item, index, e){ var t = e.getTarget('dd', 5, true); - if(t && !e.getTarget('a', 2)){ + + if (t && !e.getTarget('a', 2)) { var url = t.getAttributeNS('ext', 'url'); window.open(url); } + + return this.callParent(arguments); } - return SamplePanel.superclass.onClick.apply(this, arguments); - } -}); -Ext.samples.SamplePanel = SamplePanel; -Ext.reg('samplespanel', Ext.samples.SamplePanel); + }); })(); Ext.onReady(function() { - (function() { + + (Ext.defer(function() { // Instantiate Ext.App instance - App = new Ext.App({}); + var App = Ext.create('Ext.App', {}); var catalog = Ext.samples.samplesCatalog; @@ -78,23 +92,23 @@ Ext.onReady(function() { c.id = 'sample-' + i; } - var store = new Ext.data.JsonStore({ + var store = Ext.create('Ext.data.JsonStore', { idProperty : 'id', - fields : ['id', 'title', 'samples'], + fields : ['id', 'title', 'items'], data : catalog }); - var panel = new Ext.Panel({ - frame : true, + var panel = Ext.create('Ext.Panel', { + frame : false, renderTo : Ext.get('all-demos'), height : 300, autoScroll : true, - items : new SamplePanel({ + items : Ext.create('Ext.samples.SamplePanel', { store : store }) }); - var tpl = new Ext.XTemplate( + var tpl = Ext.create('Ext.XTemplate', '
  • {title:stripTags}
  • ' ); tpl.overwrite('sample-menu', catalog); @@ -104,14 +118,14 @@ Ext.onReady(function() { var headerEl = Ext.get('hd'), footerEl = Ext.get('ft'), bodyEl = Ext.get('bd'), - sideBoxEl = bodyEl.child('div[class=side-box]'), - titleEl = bodyEl.child('h1#pagetitle'); + sideBoxEl = bodyEl.down('div[class=side-box]'), + titleEl = bodyEl.down('h1#pagetitle'); var doResize = function() { var windowHeight = Ext.getDoc().getViewSize(false).height; - var footerHeight = footerEl.getHeight() + footerEl.getMargins().top, - titleElHeight = titleEl.getHeight() + titleEl.getMargins().top, + var footerHeight = footerEl.getHeight() + footerEl.getMargin().top, + titleElHeight = titleEl.getHeight() + titleEl.getMargin().top, headerHeight = headerEl.getHeight() + titleElHeight; var warnEl = Ext.get('fb'); @@ -127,10 +141,10 @@ Ext.onReady(function() { Ext.EventManager.onWindowResize(doResize); var firebugWarning = function () { - var cp = new Ext.state.CookieProvider(); + var cp = Ext.create('Ext.state.CookieProvider'); if(window.console && window.console.firebug && ! cp.get('hideFBWarning')){ - var tpl = new Ext.Template( + var tpl = Ext.create('Ext.Template', '' ); var newEl = tpl.insertFirst('all-demos'); @@ -147,13 +161,17 @@ Ext.onReady(function() { var hideMask = function () { Ext.get('loading').remove(); - Ext.fly('loading-mask').fadeOut({ + Ext.fly('loading-mask').animate({ + opacity:0, remove:true, - callback : firebugWarning + callback: firebugWarning }); }; - hideMask.defer(250); + Ext.defer(hideMask, 250); doResize(); - }).defer(500); -}); \ No newline at end of file + + },500)); +}); + +