2011-03-17 7 views
3

간단한 일을해야하지만 작동하지 못하는 문제가 있습니다. 여러 사이트에서 여러 가지 예를 시도하고 Sencha Touch API를 보았지만 행운은 없습니다. 내가 뭘 하려는지 외부 JSON 소스에서 목록을 작성하는 것입니다. 가능한 한 간단하게하기 위해 지금은 외부 파일에 넣었습니다.Sencha Touch로 목록을 작성하고 JSON 소스에서 채우기

Ext.setup({ 
tabletStartupScreen: 'tablet_startup.png', 
phoneStartupScreen: 'phone_startup.png', 
icon: 'icon.png', 
glossOnIcon: false, 
onReady : function() { 

    Ext.regModel('Contact', { 
     fields: ['firstName', 'lastName'] 
    }); 

    var store = new Ext.data.Store({ 
      model: 'Contact', 
      sorters: 'firstName', 

      getGroupString : function(record) { 
       return record.get('firstName')[0]; 
      }, 
      proxy: { 
       type: 'ajax', 
       url : 'test.json', 
       reader: { 
        type: 'json' 
       } 
      } 
     }); 

    var list = new Ext.List({ 
     fullscreen: true, 

     itemTpl : '{firstName} {lastName}',  
     store: store 
    }); 
    list.show();}}); 

JSON 파일

[ 
{ 
    "firstName" : "pelle", 
    "lastName": "ollesson" 
}, 
{ 
    "firstName" : "nisse", 
    "lastName": "pellssdfok" 
} 
] 

당신이 바로 그 잘못 볼 수있는 뭔가가 있나요?

미리 감사드립니다.

답변

2

확인해주세요. 분류기를 제거하고 갑자기 getGroupString을 작동 시켰습니다.

관련 문제