ExtJS笔记 Ext.data.Types
This is a static class containing the system-supplied data types which may be given to a Field.
Types是一个静态类,包含将用在Field的,系统提供的数据类型。
The properties in this class are used as type indicators in the Field class, so to test whether a Field is of a certain type, compare the type property against properties of this class.
此类中的属性会被用作Field中的类型指示器,因此,如果要测试一个字段是否某个特定类型,可将其type属性与Types类的属性来比较。
Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE. Each type definition must contain three properties:
开发者可以添加它们自定义的类型到这个类中。名称必须大写。每个类型定义必需包含三个属性:
convert: Function 转换函数
A function to convert raw data values from a data block into the data to be stored in the Field. The function is passed the collowing parameters:此函数转数据块中的原始数据到Field字段。函数会被传入两个参数:- v : Mixed
The data value as read by the Reader, if undefined will use the configured defaultValue. 被reader读取的数据,如果未定义则使用defaultValue - rec : Mixed
The data object containing the row as read by the Reader. Depending on the Reader type, this could be an Array (ArrayReader), an object (JsonReader), or an XML element. reader读取到的当前行数据对象。依赖reader的类型,这可以是一个数组(ArrayReader),对象 (JsonReader),或者xml 元素。
- v : Mixed
sortType: Function 排序类型
A function to convert the stored data into comparable form, as defined by Ext.data.SortTypes. 一个函数,将数据转换为可比较的形式,详见 Ext.data.SortTypes.type: String 类型
A textual data type name. 文本形式的类型名称。
For example, to create a VELatLong field (See the Microsoft Bing Mapping API) containing the latitude/longitude value of a datapoint on a map from a JsonReader data block
which contained the properties lat and long, you would define a new data type like this:
例如,我们创建一个VELatLong 字段(参考 Microsoft Bing Mapping API)包含地图上一个数据点的经度/维度值,数据来自JsonReader 的数据块,包含了lat和long属性。对此,你可以定义一个如下的新数据类型:
// Add a new Field data type which stores a VELatLong object in the Record.
Ext.data.Types.VELATLONG = {
convert: function(v, data) {
return new VELatLong(data.lat, data.long);
},
sortType: function(v) {
return v.Latitude; // When sorting, order by latitude
},
type: 'VELatLong'
};
Then, when declaring a Model, use:
然后,我们定义一个模型来使用:
var types = Ext.data.Types; // allow shorthand type access
Ext.define('Unit',
extend: 'Ext.data.Model',
fields: [
{ name: 'unitName', mapping: 'UnitName' },
{ name: 'curSpeed', mapping: 'CurSpeed', type: types.INT },
{ name: 'latitude', mapping: 'lat', type: types.FLOAT },
{ name: 'longitude', mapping: 'long', type: types.FLOAT },
{ name: 'position', type: types.VELATLONG }
]
});
数据类型
This data type means that no conversion is applied to the raw data before it is placed into a Record.不会发生转换
This data type means that the raw data is converted into a String before it is placed into a Record.
ExtJS笔记 Ext.data.Types的更多相关文章
- ExtJS笔记 Ext.data.Model
A Model represents some object that your application manages. For example, one might define a Model ...
- 20. Extjs学习笔记——Ext.data.JsonStore使用说明
Ext.data.JsonStore继承于Ext.data.Store,使得从远程JSON数据创建stores更为方便的简单辅助类.JsonStore合成了Ext.data.HttpProxy与Ext ...
- Extjs学习笔记——Ext.data.JsonStore使用说明
Ext.data.JsonStore继承于Ext.data.Store.使得从远程JSON数据创建stores更为方便的简单辅助类. JsonStore合成了Ext.data.HttpProxy与Ex ...
- extJS 中 ext.data 介绍
ext.data 最主要的功能是获取和组织数据结构,并和特定控件联系起来,于是,Ext.data成了数据的来源,负责显示数据. Ext.data在命名空间中定义了一系列store.reader和pro ...
- ExtJS笔记 Ext.Loader
Ext.Loader is the heart of the new dynamic dependency loading capability in Ext JS 4+. It is most co ...
- extjs笔记
1. ExtJs 结构树.. 2 2. 对ExtJs的态度.. 3 3. Ext.form概述.. 4 4. Ext.TabPanel篇.. 5 5. Functio ...
- 48.EXt.Data.JsonReader()
转自:https://blog.csdn.net/huoyanxueren/article/details/2662915?utm_source=blogxgwz6 extJs 2.1学习笔记(Ext ...
- ExtJs Ext.data.Model 学习笔记
Using a Proxy Ext.define('User', { extend: 'Ext.data.Model', fields: ['id', 'name', 'email'], proxy: ...
- Extjs 项目中常用的小技巧,也许你用得着(5)--设置 Ext.data.Store 传参的请求方式
1.extjs 给怎么给panel设背景色 设置bodyStyle:'background:#ffc;padding:10px;', var resultsPanel = Ext.create('Ex ...
随机推荐
- curl发送get和post请求
function getAction($url='') { // curl 请求一共分四步,初始化,设置属性,执行并获取结果,释放句柄 // 一.初始化 $curl = curl_init(); // ...
- WebService -- Java 实现之 CXF ( 使用CXF工具生成client 程序)
1. 下载CXF 工具解压到磁盘 2.添加工具bin目录到PATH环境变量 3.创建一个CXF client新项目 4. run -> cmd 到指定目录,并运行工具目录下的批处理 “wadl2 ...
- cf596d
题意:有一排等高的树木,高度都为h.给出每棵树在数轴上的坐标,每次有可能是最左边或者最右边的立着的树倒下,概率都是0.5.最终所有树都倒下.每棵树在倒下的时候有p的概率向左倒,1-p的概率向右倒.如果 ...
- java 深入技术六(Map)
Map 1.map概述 map.put(key,value)里面存放的是两个相关的数据,key=value键值对 Map集合中存放的是键值对(put(key,value)),用get(key)获取集合 ...
- Python3实现简单的爬虫功能
python3简单实现一个爬去网站图片的小功能: 有时候想要下载自己喜欢的多个图片时,不需要一个个点击来下载,使用python脚本批量拉取,并保存到本地. 1. 首先找到自己要下载图片的url 2. ...
- CUDA代码移植
如果CUDA的代码移植,一个是要 include文件夹对不对,这个是.h文件能否找到的关键,另一个就是lib,这个是.lib文件能否找到的关键.具体检查地方,见下头. include: lib:
- LNMP平台搭建---PHP安装篇
在前面三篇中,我们安装了Linux系统.Web服务器Nginx.MySQL数据库服务器,这篇就来将搭建动态网站的最后一步:PHP安装. Nginx服务器只能响应静态资源请求,对于动态资源请求就不行了, ...
- WebConfig配置
安全配置示例 https://msdn.microsoft.com/zh-cn/magazine/gg309184.aspx
- NSString使用stringWithFormat拼接的相关知识
NSString使用stringWithFormat拼接的相关知识 保留2位小数点 1 2 3 4 //.2代表小数点后面保留2位(2代表保留的数量) NSString *string = [NSSt ...
- 网络知识学习4---(DNS的作用)
1.DNS 简介 DNS是域名解析协议 在互联网中通过IP 地址来进行通信.但是IP 地址的表示形式是数字,很难进行记忆(比如116.213.120.232),所以为每个 IP取一个人类更易记忆的域名 ...