0
나는 목록을 만들고 데이터 저장소를 사용하여 목록에 데이터를 채 웁니다. 내가 데이터를 얻을하고 표시 할 경우sencha에서 json의 데이터로드
data.js
Ext.regModel('Contact', {
fields: ['firstName', 'lastName', 'DOB', 'group']
});
iPolis.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'lastName',
getGroupString : function(record) {
return record.get('group');
},
data: [
{ firstName: "Domino", lastName: "Derval" , DOB: "28May2008", group:"Personalize"},
]
});
코드의이 부분은 잘 실행됩니다. 이제는 데이터베이스에 연결하고 json 파일을 사용하여 data.js에서 데이터를 검색합니다.
어떻게 가능합니까?
iPolis.ListStore = new Ext.data.Store({
model : 'Contact',
proxy : {
type : 'ajax',
url : 'js/person_list.json',
reader : {
type : 'json',
//root : 'results',
// totalCount : 'total'
}
},
autoLoad : true
});
는 데이터를 얻기 위해 이것을 사용하지만 나에게 선생님은 XMLHttpRequest 가게의
examples을 확인도 엽차의 API에 Ext.data.Proxy을 통해 file.json
했었습니다. iPolis.ListStore = 새로운 Ext.data.Store ({ \t 모델 : '기업', \t 프록시 : { \t 유형 : '아약스', \t URL : '의 JS/person_list.json', \t 독자 : { \t 유형 : 'JSON', \t // 루트 '결과', \t //에서는 totalCount : '전체' \t} \t}, \t 자동로드 : 사실 \t}); 이 데이터를 가져 오는 데 사용하지만 XMLHttprequest가 file.json에서 데이터를로드 할 수 없다는 오류가 발생합니다. – Khush
jsonlint.com에서 json 파일 위치와 올바른 형식을 확인하십시오. – Swar