Search code examples
javagridgxtgxt-charts

Retrieving/Returning GXT3 Grid Values


I have been working on with a grid element from GXT and have had some trouble trying to get all the data from a grid for further manipulation. For example:

I have a grid that looks like the following

Colors


Red

Green

Blue


Is there a way to pull all the values from the grid?


Solution

  • You can try to retrieve all the data that loaded to grid from the ListStore object that you feed to the Grid constructor. Here is some code snippet:

    List<YourModelDataClass> listData = listStore.getAll();
    foreach(YourModelDataClass md : listData) {
       // do whatever you need to do with the data from your grid
    }
    

    Hope this could help you. Note: this was the code for sencha GXT 3.0.1 above. Just let me know if you need the code for sencha GXT 2.x above.