ExtJS learning ------------ infrastructure, Extjs. js and Ext-more.js Learning

Source: Internet
Author: User

ExtJS learning ------------ infrastructure, Extjs. js and Ext-more.js Learning

Ext. apply and Ext. applyIf

Ext. onReady (function () {// Ext. apply and Ext. applyIf extends var src1 = {name: 'zhang san', age: 23} to object attributes or methods; // The expanded object var src2 = {name: 'zhang san ', age: 23}; // The expanded object var config = {name: 'lily', sex: 'male'}; // configure the object // use Ext. apply is extended and will overwrite the original property or method Ext. apply (src1, config); for (var attr in src1) {alert (attr + ':' + src1 [attr]);} // use Ext. if this attribute or method exists, Ext is not replaced. applyIf (src2, config); for (var attr in src2) {alert (attr + ':' + src2 [attr]) ;}});

Result:



<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PC9wPgo8cD5FeHQub3ZlcnJpZGW3vbeoo6i4srjHo6k8L3A + CjxwcmUgY2xhc3M9 "brush: java;"> Ext. onReady (function () {Ext. define ('user', {say: function () // defines the method {alert ('say... ') ;}}); var user = Ext. create ('user'); Ext. override (user, {// method override say: function () {alert ('This is the override method... ') ;}}); user. say (); // call method });
Result:


Other methods:


Ext. onReady (function () {// typeof method, similar to var str = 'string' in javascript; alert ('Type: '+ Ext. typeOf (str); // isArray is... for more information, see the help documentation var arr = [1, 2]; alert (Ext. isArray (arr); // iterate method, traversing Ext. iterate (arr, function (item) {alert (item );});});

Result:



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.