グリッドが作成されましたが、グリッドデータとカラムをxmlからロードしようとしています。 My Columnはヘッダータグから読み込まれていますが、Gタグからのデータは読み込まれていません。 コード:グリッドのグリッドデータがxmlからロードされていません
initComponent: function() {
this.fields = [];
this.columns = [];
this.data = [];
Ext.Ajax.request({
url: 'XML/hart.xml',
scope: this,
timeout: global_constants.TIMEOUT,
method: "GET",
disableCaching: true,
failure: function(response) {
utils.showOKErrorMsg(sdisMsg.ajaxRequestFailed);
},
success: function(response) {
debugger;
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.fieldLength = this.fields.length;
this.record = [];
for (i = 0; i < this.fieldLength; i++) {
this.record.push(columnData);
}
this.data.push(this.record);
}, this);
this.store = new Ext.data.ArrayStore({
fields : this.fields
});
this.store.loadData(this.data);
}
});
buildField: function(header) {
this.fields.push({
name: header.getAttribute("DATAINDEX")
});
buildColumn: function(header) {
var hiddenflg = !(header.getAttribute("VISIBLE"));
if (header.getAttribute("VISIBLE") == "false")
hiddenflg = true;
var strHeaderName = '';
if ((Ext.isIE && !PC.common.isIE10()))
strHeaderName = header.text;
else
strHeaderName = header.textContent;
var strToolTip = "";
this.columns.push({
header: Ext.util.Format.htmlEncode(strHeaderName),
tooltip: strToolTip,
dataIndex: header.getAttribute("DATAINDEX"),
width: parseInt(header.getAttribute("LENGTH")),
metaID: header.getAttribute("M"),
enableHdMenu: false,
hidden: hiddenflg,
menuDisabled: true,
sortable: false,
scope: this,
/*renderer : function (value, metaData, record, rowIndex, colIndex, store){
debugger;
},*/
fixed: false,
expanded: true
});
},
}
はコード: グリッドで、私は店と列を与えています。
{xtype: 'panel',
title: "Search Result",
height:500,
items: [{
xtype: 'grid',
id: 'COHART_GRID',
autoHeight: true,
selType: 'checkboxmodel',
frame: true,
store: this.store,
autoHeight: true,
stripeRows: true,
columns: this.columns,
bbar: [{
xtype: 'button',
text: 'Exclude',
handler: function() {
debugger;
}
}, {
xtype: 'button',
text: 'Include',
handler: function() {
//debugger;
}
}]
}]
}
私は必要に応じてxmlを投稿します。手伝ってくれてありがとう。
私のXMLは スタディタイトル < HEADER VISIBLE = "true" をLENGTH = "100" ISSORTABLE = "true" をDATATYPE = "文字列" DATAINDEX = "STT" isKeyの= "true" をDOMAIN = "">試験薬 –
David
問題を示す[fiddle](http://fiddle.sencha.com)を作成してください。 " " STU : "this.storeに、この私のデータを適用した後 – Alexander