2015-12-30 83 views
1

我想要显示在Windows中的商店对象中加载的数据。我可以看到商店正在载入正确的数据。但是,当它传递给Panel并且Panel传递给Window时,当Window.Show被调用时,只显示列名,但不显示存储在Store对象中的数据。Extjs 4.2.2 Ext.Window.Show未显示在商店中加载的数据

请帮我这个。的代码片段如下:enter code here

var store1 = new Ext.data.Store({ 
       autoLoad:true, 
      fields: [{ 
       name: 'Index' 
      }, { 
       name: 'VrfNames' 
      }] 
     }); 
     var vrfData = [ 
      ["HI", "Hello"] 
     ]; 
     store1.loadData(vrfData); 
     console.log("Loaded " + store1.getCount() + " records"); 
     //Could verify data is loaded properly 


     // creation of panel 
     var vrfNamesPanel = new Ext.grid.Panel({ 
      store: store1, 
      columns: cm, 
      height: 250, 
      width: 700, 
      enableHdMenu: false, 
      buttons: this.buildVrfNamesPanelButtons(), 
      buttonAlign: 'center', 
      renderTo: Ext.getBody(), 
      //floating: true, 
      //closable : true//, 
      listeners: { 
       scope: this 
      } 

     }); 


     // creation of new window 
     this.vrfNamesWindow = new Ext.Window({ 
      layout: 'fit', 
      closeAction: 'hide', 
      plain: true, 
      title: "VRF Names ", 
      items: vrfNamesPanel, 
      enableTabScroll: true, 
      autoScroll: true, 
      width: 700 
     }); 

     this.vrfNamesWindow.show(); 

回答

1

这里是working fiddle你。

我不知道你的cm列设置是什么,所以我添加了它,我相信这个问题在那里。

+0

我试过工作小提琴,它与Extjs 6一起工作,但问题仍然存在,当我试图用Ext JS 4.2.1.883 Neptune运行它时(存储对象中的数据未显示在窗口中)。你能帮我解决这个问题吗?因为我们必须提供4.2。 –

+0

小提琴更新,当您在本地加载数据时(至少在小提琴中),删除'autoLoad:true'。 –

+0

谢谢!为我工作! :) –