私はinitコンポーネントに自分のAjaxを書きましたが、すべてのデータがthis.store
にあります。 しかし、私は定義したグリッドに店舗の範囲を取得していません。私はAjaxの成功の括弧を閉じているので、私はそうではありません。正しい方法は何ですか? 私のコードは次のとおりです。私はグリッドを定義東パネルで同じINIT成分でグリッド内のストアの範囲を取得する方法
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
},
});
。列は来ているが、店は出てこない。
グリッドコード我々はExt.ComponentQuery.query
としてExt.getCmp()
を使用する必要グリッドを取得し、その店舗ExtJSの3
について
Ext.ComponentQuery.query("#ABC_GRID")[0].reconfigure(this.store);
を再構成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