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 元素。
  • 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 boolean before it is placed into a Record. ...   
 
This data type means that the raw data is converted into a boolean before it is placed into a Record. ...
 
This data type means that the raw data is converted into a Date before it is placed into a Record. ...
 
This data type means that the raw data is converted into a number before it is placed into a Record. ...
 
This data type means that the raw data is converted into an integer before it is placed into a Record. ...
 
This data type means that the raw data is converted into an integer before it is placed into a Record. ...
 
This data type means that the raw data is converted into a number 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.

 
A regular expression for stripping non-numeric characters from a numeric value. ...

ExtJS笔记 Ext.data.Types的更多相关文章

  1. ExtJS笔记 Ext.data.Model

    A Model represents some object that your application manages. For example, one might define a Model ...

  2. 20. Extjs学习笔记——Ext.data.JsonStore使用说明

    Ext.data.JsonStore继承于Ext.data.Store,使得从远程JSON数据创建stores更为方便的简单辅助类.JsonStore合成了Ext.data.HttpProxy与Ext ...

  3. Extjs学习笔记——Ext.data.JsonStore使用说明

    Ext.data.JsonStore继承于Ext.data.Store.使得从远程JSON数据创建stores更为方便的简单辅助类. JsonStore合成了Ext.data.HttpProxy与Ex ...

  4. extJS 中 ext.data 介绍

    ext.data 最主要的功能是获取和组织数据结构,并和特定控件联系起来,于是,Ext.data成了数据的来源,负责显示数据. Ext.data在命名空间中定义了一系列store.reader和pro ...

  5. ExtJS笔记 Ext.Loader

    Ext.Loader is the heart of the new dynamic dependency loading capability in Ext JS 4+. It is most co ...

  6. extjs笔记

      1.    ExtJs 结构树.. 2 2.    对ExtJs的态度.. 3 3.    Ext.form概述.. 4 4.    Ext.TabPanel篇.. 5 5.    Functio ...

  7. 48.EXt.Data.JsonReader()

    转自:https://blog.csdn.net/huoyanxueren/article/details/2662915?utm_source=blogxgwz6 extJs 2.1学习笔记(Ext ...

  8. ExtJs Ext.data.Model 学习笔记

    Using a Proxy Ext.define('User', { extend: 'Ext.data.Model', fields: ['id', 'name', 'email'], proxy: ...

  9. Extjs 项目中常用的小技巧,也许你用得着(5)--设置 Ext.data.Store 传参的请求方式

    1.extjs 给怎么给panel设背景色 设置bodyStyle:'background:#ffc;padding:10px;', var resultsPanel = Ext.create('Ex ...

随机推荐

  1. ICMP的应用--Traceroute

    Traceroute是用来侦测主机到目的主机之间所经路由情况的重要工具,也是最便利的工具.前面说到,尽管ping工具也可以进行侦测,但是,因为ip头的限制,ping不能完全的记录下所经过的路由器.所以 ...

  2. .NET 泛型

    泛型      泛型将类型参数的概念引入 .NET Framework,类型参数使得设计如下类和方法成为可能:这些类和方法将一个或多个类型的指定推迟到客户端代码声明并实例化该类或方法的时候.例如,通过 ...

  3. 基于STM32和W5500的Modbus TCP通讯

    在最近的一个项目中需要实现Modbus TCP通讯,而选用的硬件平台则是STM32F103和W5500,软件平台则选用IAR EWAR6.4来实现. 1.移植千的准备工作 为了实现Modbus TCP ...

  4. hdu 1503 Advanced Fruits

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1503 思路:这是一道最长公共子序列的题目,当然还需要记录路径.把两个字符串的最长公共字串记录下来,在递 ...

  5. Redis到底该如何利用?

    Redis是个好东西,经过上两个星期的研究和实践,目前正在项目里大规模的替换掉原来的本地内存cache.但是替换过程中却发现,Redis这东西高端,大气上档次,似乎不是我想象里的使用方法. 在没有深入 ...

  6. Codeforces Round #222 (Div. 1) D. Developing Game 线段树有效区间合并

    D. Developing Game   Pavel is going to make a game of his dream. However, he knows that he can't mak ...

  7. [工作中的设计模式]责任链模式chain

    一.模式解析 责任链模式是一种对象的行为模式.在责任链模式里,很多对象由每一个对象对其下家的引用而连接起来形成一条链.请求在这个链上传递,直到链上的某一个对象决定处理此请求.发出这个请求的客户端并不知 ...

  8. jqGrid配置属性说明

    Property Type Description Default1) ajaxGridOptions object This option allows to set global ajax set ...

  9. Page-encoding specified in XML prolog (UTF-8) is different from that specified in page directive (utf-8)

    org.apache.jasper.JasperException:xxx.jsp(1,1) Page-encoding specified in XML prolog (UTF-8) is diff ...

  10. iOS 启动画面 代码自定义

    先来看一个可能会遇到的问题: 如果你已经删除了xcode为你的项目自动生成的LaunchScreen.storyboard, 然后你在测试你的app的时候发现,屏幕里出现了黑色的区域,如上图(画红线的 ...