2013-08-07 68 views

回答

2

也許這有助於。這是我刷新網格的方式:

if(!registry.byId("GraphGrid")){ 
     var grid = new EnhancedGrid({ 
        id: 'GraphGrid', 
        store: GraphicStore, 
        query: { ident: "*" }, 
        structure: layout, 
        rowSelector: '20px', 
        plugins: { 
         indirectSelection: { 
         headerSelector:true, 
         width:"40px", 
         styles:"text-align: center;" 
         }}       
        },"GridGraphicInMap"); 

       /*Call startup() to render the grid*/ 
       grid.startup(); 

       dojo.connect(grid, "onRowClick", grid, function(evt){ 
        var idx = evt.rowIndex, 
         item = this.getItem(idx); 

        // get a value out of the item 
        var value = this.store.getValue(item, "geom"); 
        highlightGeometry(value,true); 
        // do something with the value. 
      }); 
     } 
     else { 
      registry.byId("GraphGrid").setStore(GraphicStore); 
     } 

當我第一次調用我的函數時,會生成網格。 Evrytime我稍後調用該函數,只有商店被刷新。

此致,Miriam

+1

在此代碼中刷新的關鍵是重置商店。順便說一下,'dojox/grid'中的網格已被棄用;如果你開始新的東西,替換是[dgrid](http://dgrid.io)(推薦)或[gridx](https://github.com/oria/gridx)。 –

+0

謝謝你們兩個:)它有幫助 – Amila