随笔-9  评论-168  文章-266  trackbacks-0

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);


Ext.data.Record.create({...});
Returns:  function
A constructor which is used to create new Records according to the definition.
根据定义, 这个构造函数是用来创造新的记录。
posted on 2009-04-03 17:44 紫蝶∏飛揚↗ 阅读(8031) 评论(4)  编辑  收藏 所属分类: EXTJS

评论:
# re: Ext.data.Record.create({...}) 使用说明. 2010-01-20 11:55 | nanjim
myStore 在哪里定义了?  回复  更多评论
  
# re: Ext.data.Record.create({...}) 使用说明. 2010-02-15 12:59 | 紫蝶∏飛揚↗
这里主要讲的是RECORD定义方式,MYSTORE忽略了.他的定义方式很简单的:
var mystore=new Ext.data.JsonStore({
url:'...',
params:{...},
fields:TopicRecord })  回复  更多评论
  
# re: Ext.data.Record.create({...}) 使用说明. 2011-07-26 14:18 | 说明
create( Array o ) 官方API中参数为数组,。这人写的是错误的,误人子弟  回复  更多评论
  
# re: Ext.data.Record.create({...}) 使用说明. 2011-10-11 22:03 | 紫蝶∏飛揚↗
笑人...哈哈.  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: