﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-享受编程，融入其中，了解本质-文章分类-ExtJs</title><link>http://www.blogjava.net/alter/category/51333.html</link><description>美满 激情 醇厚</description><language>zh-cn</language><lastBuildDate>Sat, 07 Apr 2012 16:19:33 GMT</lastBuildDate><pubDate>Sat, 07 Apr 2012 16:19:33 GMT</pubDate><ttl>60</ttl><item><title>Extjs4特性介绍二</title><link>http://www.blogjava.net/alter/articles/373464.html</link><dc:creator>a_alter</dc:creator><author>a_alter</author><pubDate>Fri, 06 Apr 2012 06:32:00 GMT</pubDate><guid>http://www.blogjava.net/alter/articles/373464.html</guid><description><![CDATA[<div>
<h4>Mixins <br />
</h4>
<p>官方文档介绍</p>

<div>
<address>This is a new approach to plugging custom functionality into existing classes. The new mixins config, included during instantiation of a class, allows you to "mix in" new capabilities to the class prototype. This is similar to the existing Ext.override function, although it does not replace existing methods like override does, it simply augments the prototype with whatever is new.&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br /><br />&nbsp;== java override ， 不过支持多继承。 相同方法取最后实现。<br /></address><h4>Statics</h4><address></address><div>静态字段和方法定义块。<br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">Ext.define('Person',{<br />&nbsp;&nbsp;&nbsp;statics:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staticAttribute:'静态变量'，<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staticFunction:</span><span style="color: #0000FF; ">function</span><span style="color: #000000; ">(){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;静态方法</span><span style="color: #008000;"><br /></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />});<br /><br />alert(Person.staticAttribute);</span></div><br /><div><h4>Config</h4></div>这个理解为 java 的pojo中的变量， 可以自动生成以下方法， 以下代码摘官方文档。<br /><br />usage<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">Ext.define('MyClass',&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;config:&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;'Default&nbsp;Title'<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />});</span></div>自动生成以下代码<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">title:&nbsp;'Default&nbsp;Title',<br /><br />getTitle:&nbsp;</span><span style="color: #0000FF; ">function</span><span style="color: #000000; ">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.title;<br />},<br /><br />resetTitle:&nbsp;</span><span style="color: #0000FF; ">function</span><span style="color: #000000; ">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.setTitle('Default&nbsp;Title');<br />},<br /><br />setTitle:&nbsp;</span><span style="color: #0000FF; ">function</span><span style="color: #000000; ">(newTitle)&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.title&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.applyTitle(newTitle)&nbsp;</span><span style="color: #000000; ">||</span><span style="color: #000000; ">&nbsp;newTitle;<br />},<br /><br />applyTitle:&nbsp;</span><span style="color: #0000FF; ">function</span><span style="color: #000000; ">(newTitle)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;custom&nbsp;code&nbsp;here</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;e.g.&nbsp;Ext.get('titleEl').update(newTitle);</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">}</span></div><br />检测用户的使用环境&nbsp; 相关见API文档<br /><div><ul><li>Ext.env.Browser</li><li>Ext.env.FeatureDetector</li><li>Ext.env.OS</li></ul><p><br /></p></div></div><address></address>
</div><p><br />
</p>
</div><img src ="http://www.blogjava.net/alter/aggbug/373464.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alter/" target="_blank">a_alter</a> 2012-04-06 14:32 <a href="http://www.blogjava.net/alter/articles/373464.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ExtJS4 -- 动态加载</title><link>http://www.blogjava.net/alter/articles/373459.html</link><dc:creator>a_alter</dc:creator><author>a_alter</author><pubDate>Fri, 06 Apr 2012 05:25:00 GMT</pubDate><guid>http://www.blogjava.net/alter/articles/373459.html</guid><description><![CDATA[<h4>&nbsp;ExtJS4&nbsp; 新特性</h4>
<p>
</p><div>
<ul>
     <li id="ext-gen1354">Ext.define to create class definitions within the new system</li>
     <li id="ext-gen1349">Automatic dependency management and dynamic class loading</li>
     <li id="ext-gen1353">Mixins</li>
     <li id="ext-gen1350">Statics</li>
     <li id="ext-gen1352">New config option for Automatic setter / getter generation</li>
</ul>
<p>
</p><div>
<div>
<h3> Library Inclusion methods</h3>
<p id="ext-gen1530">When you unzip the Ext JS 4 download, you will see the following files:</p>
<ol>
     <li>
     <p id="ext-gen1526"><code id="ext-gen1534">ext-debug.js</code> - This file is only for use during development. It provides the minimum number of core Ext JS classes needed to get up and running. Any additional classes should be dynamically loaded as separate files as demonstrated above.</p>
     </li>
     <li>
     <p id="ext-gen1527"><code>ext.js</code> - same as <code id="ext-gen1529">ext-debug.js</code> but minified for use in production. Meant to be used in combination with your application's <code>app-all.js</code> file. (see section <em>3</em>)</p>
     </li>
     <li>
     <p id="ext-gen1528"><code>ext-all-debug.js</code> - This file contains the entire Ext JS library. This can be helpful for shortening your initial learning curve, however <code>ext-debug.js</code> is preferred in most cases for actual application development.</p>
     </li>
     <li>
     <p id="ext-gen1531"><code>ext-all.js</code> - This is a minified version of <code id="ext-gen1533">ext-all-debug.js</code> that can be used in production environments, however, it is not recommended since most applications will not make use of all the classes that it contains. Instead it is recommended that you create a custom build for your production environment as described in section <em>3</em>.</p></li>
</ol><p><span style="background-color: #ffffff; color: #0099cc;">了解不同js的使用定位</span><span style="color: #99cc00; background-color: #ffffff;"></span><br /></p>
</div>
</div>
<div>
<h4>Class Loading</h4>
</div><div>Ext 4 now includes a robust dynamic class loading system that also provides integrated dependency management. Again, this is an optional feature, but provides a couple of key benefits:</div>
<p>
</p><div>
<ul>
     <li>
     <p id="ext-gen1367"><strong id="ext-gen1383">Dynamic loading</strong>: Classes can be loaded dynamically and asynchronously at runtime simply based on the dependency tree that Ext manages internally. This means that you can stop managing brittle blocks of manual include tags in HTML pages and simply let the class loader figure out what your page needs to run. This is mostly useful in the development environment when dependency flexibility is more important than page load speed.</p>
     </li>
     <li>
     <p id="ext-gen1368"><strong id="ext-gen1382">Dynamic build generation</strong>: For production, it's usually preferable still to compile down to a single (or few) build files. Since Ext now understands the entire dependency graph at runtime, it can easily output that graph as needed (for example, in the form of a custom build configuration). And even more importantly, this capability is not restricted to the Ext namespace. You can include any number of custom classes and namespaces in addition to Ext and as long as everything is defined using the class system Ext will be able to figure out how they all relate. In the very near future, any Ext developer will have one-click custom build capability that automatically manages the entire Ext + custom application class graph, even as it changes from one minute to the next, and only builds <em id="ext-gen1384">exactly</em> what's actually needed by the app.</p>
     </li>
</ul>
<p>
</p><div>
<p id="ext-gen1369">This dynamic loading is enabled simply by using Ext.define and by defining the dependencies in code using two <span style="color: #0099cc;">new class properties:</span></p>
<ul>
     <li id="ext-gen1381"><span style="color: #0099cc;">requires:</span> The class dependencies required for a class to work. These are guaranteed to be loaded <span style="color: #0099cc;">prior to </span>the current class being instantiated.</li>
     <li id="ext-gen1372"><span style="color: #0099cc;">uses</span>: Optional class dependencies that are used by, but not required by, a class. These can be loaded <span style="color: #0099cc;">asynchronously </span>and <span style="color: #0099cc;">do not have to be available</span> for the class to be instantiated.</li>
</ul>
<p><span style="color: red;">第一种方式</span><br />
</p>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ext.require([<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.grid.*</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.data.*</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.util.*</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,</span><span style="color: #000000; "><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000; ">&nbsp; ]);</span></div>
</div>
<p>&nbsp;</p>
<p><span style="color: red;">第二种方式</span></p>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">Ext.define(</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.window.Window</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;extend:&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.panel.Panel</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;alternateClassName:&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.Window</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;requires:&nbsp;[</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.util.ComponentDragger</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.util.Region</span><span style="color: #000000; ">'</span><span style="color: #000000; ">,&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">Ext.EventManager</span><span style="color: #000000; ">'</span><span style="color: #000000; ">],<br /><br /><img src="http://www.blogjava.net/Images/dot.gif" alt="" /><img src="http://www.blogjava.net/Images/dot.gif" alt="" /><img src="http://www.blogjava.net/Images/dot.gif" alt="" /><br /><br />});</span></div><p>
</p>
<p><br />
</p>
</div>
<p>&nbsp;</p>
<p><br />
</p>
<p><br />
</p>
</div>
<br />
<p>&nbsp;</p><img src ="http://www.blogjava.net/alter/aggbug/373459.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alter/" target="_blank">a_alter</a> 2012-04-06 13:25 <a href="http://www.blogjava.net/alter/articles/373459.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>