2013-08-07 70 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