2014-01-09 56 views
0

我試圖用示例數據填充我的網格,我看到的所有行都是正在創建的行,並且沒有數據。 但是,列標題存在。 我嘗試了類似的問題提出的各種步驟,似乎沒有任何工作。 這裏的任何幫助都會很棒。EXT Grid面板不會填充數據並創建空白行

Ext.define('TestModel', { 
extend: 'Ext.data.Model', 
id_property: 'test_id', 
fields: [ 
    {name: 'Date', type: 'string'}, 
    {name: 'Notifications', type: 'string'}, 
    {name: 'Status', type: 'string'} 
] 
}); 

Ext.define('D.application.component.dataexplorer.ErrNotifGridPanel',{ 
extend: 'Ext.grid.Panel', 

initComponent: function() 
{ 
    this.currUserId = DesktopConfig.data.items[0].raw.User_Id; 

    var defaultModel = [ 
         { 
          header: 'Date', 
          dataIndex: 'Msg_Date', 
          sortable: true       
         }, 
         { 
          header: 'Notifications', 
          dataIndex: 'Content', 
          sortable: false 
         }, 
         { 
          header: 'Status', 
          dataIndex: 'Msg_Status', 
          sortable: true, 
          center: true 
         }]; 

    //Sample Test Data 
    var testData = [ 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'ERROR'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
      ['16/12/2008 16:45:32', 'fdshfsdhfdsklfhdsfghdsghdsgkhdskdslkvdslkjds', 'WARNING'], 
     ]; 

    // Test Data 
    var Store = Ext.create('Ext.data.ArrayStore', { 
     model:'TestModel', 
     data:testData, 
     autoLoad:true, 
     proxy: { 
      type: 'memory', 
    /*  reader: { 
       type: 'json', 
       root: 'items' 
      } */ 
     }, 
     storeId: 'testModel' 
    }); 

    var config = 
    { 
     columns  : defaultModel, 
     store  : 'testModel', 
     columnLines : true, 
     loadMask : true, 
     autoScroll : true 
    }; 

    Ext.apply(this,config); 
    this.callParent(arguments); 
}, 

onRender: function() 
{ 
    this.callParent(arguments); 
} 
}); 

回答

1

您的列和模型字段有不同的名稱。

dataIndex應映射到您的模型中的字段name

工作示例:http://jsfiddle.net/ex2Le/

+0

感謝您的幫助...像一個魅力工作.. – user3176314