모델 만들기, id 설정

3519 단어 만들다
 1 /** 

 2          *  , id

 3          */  

 4          Ext.onReady(function(){

 5              Ext.define('Person',{

 6                 extend:'Ext.data.Model',

 7                 idProperty:'personId',

 8                 fields:[

 9                     {name:'name',type:'string'},

10                     {name:'age',type:'int'}

11                 ]

12             });

13             var person1 = new Person({

14                 personId:'person1',

15                 name:'zhouhai',

16                 age:12,

17             });

18             var person2 = new Person({

19                 personId:'person2',

20                 name:'zhouhai',

21                 age:12,

22             });

23             //   person.name

24             //person.set({name:'hello'});

25 

26             //alert(person.get('name'));

27             console.log(person1);

28 

29             console.log(person2);

30         });

좋은 웹페이지 즐겨찾기