Class Ext.data.Record create方法本身就有说明字段的定义:
来源:互联网 发布:淘宝天天特价网址 编辑:程序博客网 时间:2024/06/11 08:10
Class Ext.data.Record create方法本身就有说明字段的定义:
create( [Array o] ) : function
<static> Generate a constructor for a specific Record layout.
<static> Generate a constructor for a specific Record layout.
Parameters:
o : Array
An Array of field definition objects which specify field names, and optionally, data types, and a mapping for an Ext.data.Reader to extract the field's value from a data object. Each field definition object may contain the following properties:
name : String
The name by which the field is referenced within the Record. This is referenced by, for example, the dataIndex property in column definition objects passed to Ext.grid.ColumnModel
mapping : String
(Optional) A path specification for use by the Ext.data.Reader implementation that is creating the Record to access the data value from the data object. If an Ext.data.JsonReader is being used, then this is a string containing the javascript expression to reference the data relative to the Record item's root. If an Ext.data.XmlReader is being used, this is an Ext.DomQuery path to the data item relative to the Record element. If the mapping expression is the same as the field name, this may be omitted.
type : String
(Optional) The data type for conversion to displayable value. Possible values are
auto (Default, implies no conversion)
string
int
float
boolean
date
sortType : Mixed
(Optional) A member of Ext.data.SortTypes.
sortDir : String
(Optional) Initial direction to sort. "ASC" or "DESC"
convert : Function
(Optional) A function which converts the value provided by the Reader into an object that will be stored in the Record. It is passed the following parameters:
v : Mixed
The data value as read by the Reader.
rec : Mixed
The data object containing the row as read by the Reader. Depending on Reader type, this could be an Array, an object, or an XML element.
dateFormat : String
(Optional) A format String for the Date.parseDate function.
defaultValue : Mixed
(Optional) The default value passed to the Reader when the field does not exist in the data object (i.e. undefined). (defaults to "")
usage:
var TopicRecord = Ext.data.Record.create([
{name: 'title', mapping: 'topic_title'},
{name: 'author', mapping: 'username'},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text'}
]);
var myNewRecord = new TopicRecord({
topic_title: 'Do my job please',
username: 'noobie',
topic_replies: 1,
post_time: new Date(),
user2: 'Animal',
post_text: 'No way dude!'
});
myStore.add(myNewRecord);
In the simplest case, if no properties other than name are required, a field definition may consist of just a field name string.
Returns:
function
A constructor which is used to create new Records according to the definition.
create( [Array o] ) : function
<static> Generate a constructor for a specific Record layout.
<static> Generate a constructor for a specific Record layout.
Parameters:
o : Array
An Array of field definition objects which specify field names, and optionally, data types, and a mapping for an Ext.data.Reader to extract the field's value from a data object. Each field definition object may contain the following properties:
name : String
The name by which the field is referenced within the Record. This is referenced by, for example, the dataIndex property in column definition objects passed to Ext.grid.ColumnModel
mapping : String
(Optional) A path specification for use by the Ext.data.Reader implementation that is creating the Record to access the data value from the data object. If an Ext.data.JsonReader is being used, then this is a string containing the javascript expression to reference the data relative to the Record item's root. If an Ext.data.XmlReader is being used, this is an Ext.DomQuery path to the data item relative to the Record element. If the mapping expression is the same as the field name, this may be omitted.
type : String
(Optional) The data type for conversion to displayable value. Possible values are
auto (Default, implies no conversion)
string
int
float
boolean
date
sortType : Mixed
(Optional) A member of Ext.data.SortTypes.
sortDir : String
(Optional) Initial direction to sort. "ASC" or "DESC"
convert : Function
(Optional) A function which converts the value provided by the Reader into an object that will be stored in the Record. It is passed the following parameters:
v : Mixed
The data value as read by the Reader.
rec : Mixed
The data object containing the row as read by the Reader. Depending on Reader type, this could be an Array, an object, or an XML element.
dateFormat : String
(Optional) A format String for the Date.parseDate function.
defaultValue : Mixed
(Optional) The default value passed to the Reader when the field does not exist in the data object (i.e. undefined). (defaults to "")
usage:
var TopicRecord = Ext.data.Record.create([
{name: 'title', mapping: 'topic_title'},
{name: 'author', mapping: 'username'},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text'}
]);
var myNewRecord = new TopicRecord({
topic_title: 'Do my job please',
username: 'noobie',
topic_replies: 1,
post_time: new Date(),
user2: 'Animal',
post_text: 'No way dude!'
});
myStore.add(myNewRecord);
In the simplest case, if no properties other than name are required, a field definition may consist of just a field name string.
Returns:
function
A constructor which is used to create new Records according to the definition.
- Class Ext.data.Record create方法本身就有说明字段的定义:
- ext.data.record.create中 name与mapping的区别
- ext.data.record.create中 name与mapping的区别
- Ext.data.Record
- Ext.data.Record
- Ext.data专题三:Ext.data.Record
- Ext.data- Connection/Ajax/Record
- Ext.data- Connection/Ajax/Record
- Ext.data- Connection/Ajax/Record
- Ext.data.Record使用示例
- Ext.data.Record前台的"数据库行数据"
- 轉換 Ext.data.record 為 json 格式
- Ext.form.FormPanel定义的参数说明
- Ext.form.FormPanel定义的参数说明
- Ext.data简介(专门针对store和record已经collect()方法)
- Ext.create()方法浅析
- EXT核心API详解Ext.data(八) -Connection/Ajax/Record
- Ext.data.Record 的基本法及其 API 帮助的一个 Bug
- BuguMongo通过BuguFS类来操作GridFS文件系统,能够实现对文件的保存、获取、删除、重命名、移动等操作,而且能够按文件夹组织文件。
- IntrospectorCleanupListener介绍
- 解决Hibernate报java.net.SocketException:Software caused connection abort:socket write error
- 获取网页源码,以及内网通过代理访问外网获取
- Group by all | with cube | with rollup 的3用法
- Class Ext.data.Record create方法本身就有说明字段的定义:
- 程序员十个人有八个人讲不清楚以前做的是什么
- Regression testing
- 进程的阻塞和挂起的区别(整理)
- 经典网页设计:30个独具匠心的单页网站设计案例
- DIV CSS网页布局中常用的列表元素ul ol li dl dt dd释义
- 念,心随君浅舞天涯
- python 复制与删除
- subprocess.Popen() 必须加上close_fds=True(