Ext.create()方法浅析
来源:互联网 发布:mac ssh工具 编辑:程序博客网 时间:2024/06/05 11:40
译自:http://docs.sencha.com/extjs/4.2.0/#!/api/Ext-method-create
Instantiate a class by either full name, alias or alternate name.
If Ext.Loader is enabled and the class has not been defined yet, it will attempt to load the class via synchronous loading.
For example, all these three lines return the same result:
// alias var window = Ext.create('widget.window', { width: 600, height: 800, ... }); // alternate name var window = Ext.create('Ext.Window', { width: 600, height: 800, ... }); // full class name var window = Ext.create('Ext.window.Window', { width: 600, height: 800, ... }); // single object with xclass property: var window = Ext.create({ xclass: 'Ext.window.Window', // any valid value for 'name' (above) width: 600, height: 800, ... });
Available since: 3.4.0
Parameters
- name : String (optional)
The class name or alias. Can be specified as
xclass
property if only one object parameter is specified. - args : Object... (optional)
Additional arguments after the name will be passed to the class' constructor.
Returns
- Object
instance
通过指定的名称 实例化一个类,其中第二个参数 中的 键值对 为 构造器 提供 实例化 时对应的参数名和值。
Ext.create()和Ext.widget()的区别:
Ext.widget
Convenient shorthand to create a widget by its xtype or a config object. See also Ext.ClassManager.instantiateByAlias.
var button = Ext.widget('button'); // Equivalent to Ext.create('widget.button'); var panel = Ext.widget('panel', { // Equivalent to Ext.create('widget.panel') title: 'Panel' }); var grid = Ext.widget({ xtype: 'grid', ... });
If a component instance is passed, it is simply returned.
Available since: 4.0.0
Parameters
- name : String (optional)
The xtype of the widget to create.
- config : Object (optional)
The configuration object for the widget constructor.
Returns
- Object
The widget instance
widget可以通过别名访问 组件:
如下:
Ext.define('cdkj.view.correct.end.CorrectionEndListView',{
extend : 'Ext.grid.Panel',
alias : 'widget.correctCorrectionEndListView',
store : 'correct.CorrectionEndStore',
layout : {
type : 'fit'
},
title : '归档档案列表',
这时我们可以通过:
var view= Ext.widget("correctCorrectionEndListView");
创建一个cdkj.view.correct.end.CorrectionEndListView类的实例。
- Ext.create()方法浅析
- ExtJs学习一 Ext.define 与 Ext.create 方法总结
- ExtJS4教程——2、Ext.onReady、Ext.define、Ext.create基础方法
- Ext.form.SmartImg Create
- ExtJS4 Ext.create弹出新窗口
- Class Ext.data.Record create方法本身就有说明字段的定义:
- EXTJS4自学手册——EXT基本方法、属性(onReady、define、create)
- [ExtJS5学习笔记]第二十一节 Extjs5中使用config配置给ext.widget或者create方法传递参数
- sencha touch 2中 Ext.create与Ext.define区别
- Ext中new 和create的区别
- Ext 3 学习(2) -- create 用法
- Ext中new 和create的区别
- Ext.create的使用及扩展
- Ext JS 4的Application用法浅析。
- schemaExport create 方法参数
- File.Create()方法
- OpenERP重载create方法
- OpenERP重载create方法
- 【原创】【NOIP】文化之旅
- 将截断字符串或二进制数据
- Map集合遍历的四种方式
- Redhat7使用yum安装Oracle 11g快速安装
- Myeclipse 10 无脑破解
- Ext.create()方法浅析
- android 讯飞文档中语音停顿合成技巧
- solr+mysql数据同步配置
- wifidog源码大概分析
- ubuntu ftp服务器
- 《多线程编程》学习之八:方法join()的使用、类ThreadLocal的使用
- android在线升级
- Python入门基础(一)
- 自定义弹性的ScrollView