2016-07-01 10 views
-1

ajax呼び出しでアイテムパネルとしてグリッドを読み込もうとしています。私のグリッドが読み込まれていません。手伝ってくれませんか。これは、私がext ajax呼び出しのスコープを取得していないために試していることです。私はここに置いてグリッドがペナルティのアイテムとして読み込まれていません。

私のコードは

{ 
       xtype: 'panel', 
       title: "Search Result", 
       height:500, 
       items: [ 
         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) { 
           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) { 
           //debugger; 
            //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);  
           var grid = new Ext.grid.GridPanel({ 
             store: this.store, 
             flex: 1, 
             columns: this.columns, 
             stripeRows: true, 
             id: 'RID', 
             autoHeight: true, 
             //sm: new Ext.grid.Checkbo;xSelectionModel({singleSelect:true}), 
             frame: true, 
            }); 
          } 
         }) 
         ] 

      }] 

実は、私はなっていなかった範囲があります。

答えて

0
{ 
    xtype: 'panel', 
    title: "Search Result", 
    height:500, 
    items: [{ 
     xtype : 'GridPanel', 
     store: new Ext.data.ArrayStore({ 
      fields : this.fields 
     }), 
     flex: 1, 
     columns: this.columns, 
     stripeRows: true, 
     id: 'RID', 
     autoHeight: true, 
     //sm: new Ext.grid.Checkbo;xSelectionModel({singleSelect:true}), 
     frame: true, 
     listeners { 
      afterRenderer : function(){ 
       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) { 
         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) { 
          //debugger; 
          //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); 
        }); 
       } 
      }) 
     } 
    } 
    ] 
} 
関連する問題