amaynard

enhancedgrid not updating

Discussion created by amaynard on Feb 26, 2013
Latest reply on Feb 27, 2013 by amaynard
I've modified the find sample to use the enhanced dojo grid.  The first find task works fine, but any following will update the map but NOT the table.  I've included my showresults function which does the legwork for the table.  Examining firebug shows indicates there's something up with the store, but i just cannot seem to figure out how to clear it.  Thanks for you help in advance.

function showResults(results) {
    
     //symbology for graphics
        var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
        var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
        var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));

        //find results return an array of findResult.
        map.graphics.clear();
        var items = [];
  // close store, this should clear data
        //Build an array of attribute information and add each found graphic to the map
        dojo.forEach(results, function(result) {
   
    var graphic = result.feature;
          items.push([result.layerName, result.foundFieldName, result.value]);
          switch (graphic.geometry.type) {
          case "point":
            graphic.setSymbol(markerSymbol);
            break;
          case "polyline":
            graphic.setSymbol(lineSymbol);
            break;
          case "polygon":
            graphic.setSymbol(polygonSymbol);
            break;
          }
          map.graphics.add(graphic);
     return result.feature.attributes;
        });
          var data = {
          items: items
        };
       console.log(data)

     var store = new dojo.data.ItemFileWriteStore({clearOnClose: true, data: data
        });
     console.log(store)

  /*set up layout*/
var layout = [[
      {'name': 'Column 1', 'field': '0'},
      
    ]];

  /*create a new grid:*/
    var grid = new dojox.grid.EnhancedGrid({
  id: 'grid',
        store: store,
        structure: layout,
        rowSelector: '20px',
  plugins: {
            exporter: true}},
      document.createElement('div'));

    /*append the new grid to the div*/
    dojo.byId("grid").appendChild(grid.domNode);

   

    grid.startup();

Outcomes