2012-01-10 2 views
1
I am unable to load the below xml in to List using Sencha. 

<?xml version="1.0" encoding="UTF-8"?> 
<bdayevents> 
<bdayevent>Acceptance Letters</bdayevent> 
<bdayevent>Acceptance Letters</bdayevent> 
</bdayevents> 

This is the model which i am trying to use as there are no attributes to my XML. 

Ext.regModel('BEvent',{name:'bdayevent'}); 
var store = new Ext.data.Store({ model: 'BEvent', 
proxy: { 
type: 'ajax', 
url: 'http://localhost:8080/JSON/BirthdayInvitations.xml', 
reader: { 
type : 'xml', 
root : 'bdayevents', 
model : 'BEvent', 
record : 'bdayevent' 
} 
} 


}); 

이것은 준비 중에 호출하려고 시도하는 목록입니다.Sencha를 사용하여 XML에서 목록으로 데이터를로드 할 수 없습니다

위 스 니펫의 결과는 인덱스가 a에서 z로 표시되는 빈 페이지입니다.

이 문제를 해결할 때 도움을주십시오.

감사합니다, 시암

답변

0

Ext.regModel('BEvent', { 
     fields: ['bdayevent'] 
    }); 
    var store = new Ext.data.Store({ 
     model: 'BEvent', 
     method:'get', 
     proxy: { 
      type: 'ajax', 
      url : 'BirthdayInvitations.xml', 
      //url: 'test1.xml', 
      reader: { 
       type : 'xml', 
       record: 'bdayevents' 
      } 
     }, 
     autoLoad: true 
    }); 
    var XMLTpl = new Ext.XTemplate(
     '<tpl for=".">', 
      '<div>{bdayevent}', 
     '</tpl>' 
    ); 
    var list = Ext.create('Ext.List', { 
     fullscreen: true, 
     store: store, 
     onItemDisclosure: {}, 
     itemTpl: XMLTpl 
    }); 
시도
관련 문제