Clear Grid of Results

713
2
Jump to solution
07-17-2014 12:12 PM
jaykapalczynski
Frequent Contributor

If I am populating my grid as such how to I clear it.....when I rerun my function to get new data in a new area the last results are there untill the code finishes running....I want that to clear first before running the code.

Function updateGrid(featureSet) {

   var data = arrayUtils.map(featureSet.features, function (entry, i) {

        return {

            id: entry.attributes.OBJECTID,

            SITENAME: entry.attributes.SITENAME,

            WATERBODY: entry.attributes.WATERBODY,

            ACCESSAREA: entry.attributes.ACCESSAREA,

            LOCATION: entry.attributes.LOCATION

        };

    });

   // If you use a store...

  dataStore = new Memory({

     "data": data,

     "idProperty": "id"

  });

  gridNoColumnSets.set("store", dataStore);

  gridNoColumnSets.startup();

}

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jay,

  If it is a dgrid you are talking about then you have to add an empty store to it before you go through your loop to add the new store.


function clearMyGrid()


{


     var emptyCells = { items: "" };


     var emptyStore = new dojo.data.ItemFileWriteStore({data: emptyCells});

     gridNoColumnSets.setStore(emptyStore);


}

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Jay,

  If it is a dgrid you are talking about then you have to add an empty store to it before you go through your loop to add the new store.


function clearMyGrid()


{


     var emptyCells = { items: "" };


     var emptyStore = new dojo.data.ItemFileWriteStore({data: emptyCells});

     gridNoColumnSets.setStore(emptyStore);


}

jaykapalczynski
Frequent Contributor

Drove me a bit bonkers for a bit till I realized I was missing

"dojo/data/ItemFileWriteStore",

Thank you much for your help....very appreciated.

0 Kudos