초기화 컴포넌트에 Ajax를 작성했고 모든 데이터가 this.store
에 필요합니다. 그러나 내가 정의한 그리드에서 저장소의 범위를 얻지는 않습니다. 저는 Ajax 성공의 대괄호를 닫고 있기 때문에 저는 아닙니다. 올바른 방법은 무엇입니까? 내 코드는 다음과 같습니다 동쪽 패널에서 같은 초기화 구성 요소에서그리드에 저장 범위를 얻는 방법
initComponent: function() {
this.fields = [];
this.columns = [];
this.data = [];
this.store = [];
Ext.Ajax.request({
url: 'XML/1Cohart.xml',
scope: this,
timeout: global_constants.TIMEOUT,
method: "GET",
disableCaching: true,
failure: function(response) {
utils.showOKErrorMsg(sdisMsg.ajaxRequestFailed);
},
success: function(response) {
var datas = response.responseXML;
Ext.each(datas.getElementsByTagName("HEADER"), function(header) {
this.buildField(header);
this.buildColumn(header);
}, this);
Ext.each(datas.getElementsByTagName("G"), function (columnData) {
this.buildData(columnData);
this.fieldLength = this.fields.length;
this.record = [];
for (i = 0; i < this.fieldLength; i++) {
//debugger;
var fieldName = this.fields[i].name
this.record[i] = columnData.getAttribute(fieldName);
}
this.data.push(this.record);
}, this);
this.store = new Ext.data.ArrayStore({
fields : this.fields
});
this.store.loadData(this.data); // Getting correct data in this.store
},
});
내가 그리드를 정의했다. 어떤 칼럼이 왔는지는 모르겠지만 상점은 얻지 못하고있다.
그리드 코드는
{
xtype: 'panel',
region: "east",
header: true,
collapsible: true,
autoScroll: true,
//columnWidth: 0.5,
width: "30%",
hideBorders: true,
split: true,
items: [{
xtype: 'panel',
title: "Search Result",
height:500,
items: [{
xtype: 'grid',
itemid: 'ABC_GRID',
store : this.store,
autoHeight: true,
sm: new Ext.grid.CheckboxSelectionModel({singleSelect:true}),
frame: true,
columns : this.columns,
}]
}]
'initComponent'가 어떤 구성 요소에서 호출됩니까? 귀하의 그리드 코드가 정의 된 곳은 어디입니까? –
그리드도 init 구성 요소에 있습니다. Ajax 성공에서만'this.store'의 범위를 잃어 가고 있습니다. – David