2015-01-22 6 views
1

아약스 POST 요청으로 격자를로드하고이 데이터 (첫 번째 빈 임) 그리드를로드하지만 심지어 내가 couldnt는 데이터가로드 가져올 수 없습니다 격자. 내가 뭘 잘못하고있어?내가 <strong>아약스에게</strong> 요청을하여 일부 데이터를 얻을 필요가

   var gridFlightForms = Ext.create('Ext.grid.Panel', { 
       id : 'gridFlightForms', 
       store : storeFlightFormList, 
       width : '100%', 
       height : 300, 
       collapsible : false, 
       multiSelect : false, 
       autoScroll : true, 
       disableSelection : false, 
       monitorWindowResize : true, 
       viewConfig : { 
        stripeRows : true, 
        enableTextSelection : true 
       }, 
       title : 'Flight Forms ', 
       bbar : Ext.create('Ext.ux.statusbar.StatusBar', { 
        id : 'gridData-statusbar', 
        defaultText : '', 
        defaultIconCls : 'default-icon', 
       }), 
       verticalScroller : { 
        xtype : 'paginggridscroller', 
       }, 
       columns : [ { 
        text : '<fmt:message key="common.number.text" />', 
        xtype : 'rownumberer', 
        width : 40, 
        sortable : false 
       }, { 
        text : 'Form Id', 
        menuDisabled : true, 
        dataIndex : 'formId', 
        width : 150, 
       }, { 
        text : 'Form no', 
        menuDisabled : true, 
        dataIndex : 'formNo', 
        width : 150, 
       }, { 
        text : 'Form Type', 
        menuDisabled : true, 
        dataIndex : 'formType', 
        width : 150, 
       }, { 
        text : 'Flight Id', 
        menuDisabled : true, 
        dataIndex : 'flightId', 
        width : 150, 
       }, { 
        text : 'Revision', 
        menuDisabled : true, 
        dataIndex : 'revision', 
        width : 150, 
       }, { 
        text : 'IsLiex', 
        menuDisabled : true, 
        dataIndex : 'isLiex', 
        width : 150, 
       }, { 
        text : 'IsPrimary', 
        menuDisabled : true, 
        dataIndex : 'isPrimary', 
        width : 150, 
       }, { 
        text : 'Step Number', 
        menuDisabled : true, 
        dataIndex : 'stepNumber', 
        width : 150, 
       } ] 
      }); 

및 내 가게 :

여기 내 그리드입니다

var storeFlightFormList = Ext.create('Ext.data.Store', { 
    model : flightListModelName, 
    autoLoad : false, 
    proxy : { 
     type : 'ajax', 
     actionMethods : { 
      read : 'POST' 
     }, 
     reader : { 
      type : 'json', 
      root : 'data' 
     }, 
     api : { 
      read : flightFormListUrl 
     } 
    }, 
    listeners : { 
     load : function(store, records) { 
     } 
    } 
}); 

그 부분은 게시물을 만들고 그리드에 데이터를로드하려고합니다. 나는이 부분이 잘못되었다고 생각한다.

사실 난 내가 그것을 디버깅 resp.data에서 데이터를 볼 수 있습니다,하지만 난 이전에 언급 한 바와 같이 나는 그것을 저장하지 못할.

postDataAsParamsINN(
                      {flightId : flightId},flightFormListUrl,function(resp) { 
                       gridFlightForms.setLoading(true,true); 
                       storeFlightFormList.loadRawData(resp.data,false); 
                      });                                   
                    Ext.getCmp('gridFlightForms').getStore().load(); 

전 extjs에서 꽤 신나는 데, 미리 감사드립니다.

답변

0

postDataAsParamsINN 님의의, 당신은 당신 자신의 데이터를 로딩 할 필요가 없습니다.

fiddle은 JSON 저장소를 사용하는 작업 그리드를 보여줍니다. 여기

코드입니다 :

당신이 자동으로 저장소에로드 된 어떤 정보 그리드를 채우고 가게가 업데이트 될 때 새로 고침 그리드에 상점을 결합하면
Ext.application({ 
    name: 'Fiddle', 

    launch: function() { 
     var store = Ext.create('Ext.data.JsonStore', { 
      storeId: 'simpsonsStore', 
      fields: ['name', 'email', 'phone'], 
      autoLoad: true, 
      proxy: { 
       type: 'ajax', 
       url: 'data1.json', 
       reader: { 
        type: 'json', 
        rootProperty: 'characters' 
       } 
      }, 
      listeners: { 
       load: function() { 
        console.log(this); 
       } 
      } 
     }); 

     Ext.create('Ext.grid.Panel', { 
      title: 'Simpsons', 
      store: store, 
      columns: [{ 
       text: 'Name', 
       dataIndex: 'name' 
      }, { 
       text: 'Email', 
       dataIndex: 'email', 
       flex: 1 
      }, { 
       text: 'Phone', 
       dataIndex: 'phone' 
      }], 
      height: 200, 
      width: 400, 
      renderTo: Ext.getBody() 
     }); 
    } 
}); 

.

관련 문제