---
title: "项目~~~Ext~~~小知识点"
author: "liuyuru"
date: "2010-11-18T09:13:44Z"
tags: ["Ajax", "CSS", "EXT", "XML", "json"]
categories: ["编程语言"]
slug: "ext"
draft: false
lastmod: "2010-11-18T09:13:44Z"
id: 814607
url: "https://liuyuru.iteye.com/blog/814607"
---

1，**apply**( Object obj, Object config, Object defaults ) : Object

复制config对象的所有属性到obj（第一个参数为obj，第二个参数...

复制config对象的所有属性到obj（第一个参数为obj，第二个参数为config）。Copies all the properties of config to obj.

**参数项：**

- obj : Object

属性接受方对象。The receiver of the properties

- config : Object

属性源对象。The source of the properties

- defaults : Object

默认对象，如果该参数存在，obj将会得到那些defaults有而config没有的属性。A different object that will also be applied for default values

**返回值：**

- Object  
  returns obj @member Ext apply

2，**var** mask = **new** Ext.LoadMask("grid", {msg:"删除中,请稍等..."});

mask.show();

mask.hide();

 

3，

    **function** errorPrompt(info,image){

       Ext.MessageBox.show({

           title: '提示',

           msg: info,

           buttons: Ext.MessageBox.OK,

           icon: image

       });

    }

errorPrompt("信息填写不完整！",Ext.MessageBox.WARNING);

                                

 

4，**function** topPrompt(msg){

       **var** f = **function**() {

           **return** **function**() {

              Ext.MessageBox.hide();

              Ext.example.msg('温馨提示', msg);

           };

       };

       setTimeout(f(), 500);

    }

topPrompt(action.result.msg.tip);

 

5\. **resizable** : Boolean

True 表示为允许用户从window的四边和四角改变window的大...

True 表示为允许用户从window的四边和四角改变window的大小（默认为 true）。True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).

                    

 

```
6，// 显示一个使用配置选项的对话框： Show a dialog using config options:
```

```
Ext.Msg.show({
```

```
   title:'Save Changes?',
```

```
   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
```

```
   buttons: Ext.Msg.YESNOCANCEL,
```

```
   fn: processResult,
```

```
   animEl: 'elId',
```

```
   icon: Ext.MessageBox.QUESTION
```

```
});
```

7，**setIcon**( String icon ) : Ext.MessageBox

添加指定的图标到对话框中。默认情况下，'ext-mb-icon' 被应...

添加指定的图标到对话框中。默认情况下，'ext-mb-icon' 被应用于默认的样式，给定的样式类需要指定背景图片地址。如果要清除图标则给定一个空字串（''）。下面是提供的内建图标样式类，当然你也可以给定一个自定义的类： Adds the specified icon to the dialog. By default, the class 'ext-mb-icon' is applied for default styling, and the class passed in is expected to supply the background image url. Pass in empty string ('') to clear any existing icon. The following built-in icon classes are supported, but you can also pass in a custom class name:

Ext.MessageBox.INFO

Ext.MessageBox.WARNING

Ext.MessageBox.QUESTION

Ext.MessageBox.ERROR

**参数项：**

- icon : String

一个指定了背景图片地址的 CSS 类名，或者一个空字串表示清除图标。A CSS classname specifying the icon's background image url, or empty string to clear the icon

**返回值：**

- Ext.MessageBox  
  this

8，Ext.form.Field.prototype.msgTarget = 'side';

  **msgTarget** : String

错误提示的显示位置。可以是以下列表中的任意一项（默认为"qtip"）。...

错误提示的显示位置。可以是以下列表中的任意一项（默认为"qtip"）。The location where error text should display. Should be one of the following values (defaults to 'qtip'):

9， **var** studentNo = **new** Ext.form.TextField( {

       fieldLabel : '学号',

       allowBlank : **false**,

       name : 'studentNo',

       emptyText:"请输入7位数字学号",

       regex:/^\[0-9]{7}$/,

       width : 200,

       listeners:{

            onparse:**function**(){

              **return** **false**;

           }

       }

    });

Listeners事件是用来判断不能粘贴复制的

10，ext中ComboBox对象的selectOnFocus属性是做什么用的？

这个属性是指当你点击输入框或者输入框对应的label时，焦点自动移到输入框内，而且框内的所有文字都被选中。 这样，只要点击框后，就可以直接输入文字了

 

11，   json的由来

由于Ajax和REST技术的出现影响了应用程序架构，这迫使人们开始寻求\`XML的替代品，如：JavaScript Object Notation（JSON）。尽管 “Ajax”中的“x”代表XML，Web services也通过坚持使用XML格式而成为主流，但这并不意味着这种方式无懈可击。在文本处理方面，XML在Ajax程序的应用中已经暴露出一些缺点。在这种情形下，JSON逐渐成为引人注目的XML替代方案。