Ext3.0学习笔记record

var myRecord = Ext.data.Record.create([
   {name:"title"},
   {name:"username",mapping:"author"},
   {name:"loginTimes",type:"int"},
   {name:"lastlogintime",mapping:"loginTime",type:"date"}
 ]);
 
 var r = new myRecord({
   title:"日志标题",
   username:"easyif",
   loginTimes:100,
   lastlogintime:new Date()
 });
 
 r.set("title","改变?");
 
 alert(myRecord.getField("username").mapping);  //author
 alert(myRecord.getField("lastlogintime").type);  //date
 alert(r.data.username);  //easyif
 alert(r.get("loginTimes"));   //100
 alert(myRecord.getField("title").type);  //auto
 alert(myRecord.getField("title").mapping);   //null
 alert(r.dirty);  //判断记录是否被改过,改过为true,没改为false,上面设置了set()之后,为true
 alert(r.data.title);  //改变?

你可能感兴趣的:(ext)