Data Grid export to excel or csv

Discussion created by deleted-user-yA_w_FC9FKe5 on Jun 18, 2014
Latest reply on Jun 18, 2014 by deleted-user-yA_w_FC9FKe5
Not sure how to go about this.  We need to be able to export the data in the data grid to excel or csv.  Our application will be used on PC and tablets.  I thought the EnhancedGrid might be the answer with the dojox.grid.enhanced.plugins.exporter.CSVWriter.  However, I'm not having much luck. 
I thought I would just need to do this since my datagrid was already loaded with the correct data:

1.) Add  plugins { exporter: true } to my datagrid but not sure how to do this.

2.)  Add this functions to the script

function exportAll(){
    dijit.byId("gridCE").exportGrid("csv", function(str){
        dojo.byId("output").value = str;
function exportSelected(){
    var str = dijit.byId("gridCE").exportSelected("csv");
    dojo.byId("output").value = str;

3.) Create buttons
<button onclick="exportAll()">Export all to CSV</button>
<button onclick="exportSelected()">Export Selected Rows to CSV</button>

4.) Add references

Current Data Grid.

<button onclick="exportAll()">Export all to CSV</button>
<button onclick="exportSelected()">Export Selected Rows to CSV</button>

<table  data-dojo-type="dojox.grid.EnhancedGrid" jsid="gridCE" id="gridCE" selectionMode="single">

              <th field="FID" formatter="makeZoomButton" width="30px">
                <img alt="+" src="assets/images/GenericSearch32.png"/>
         <th field="FID" width="100px">FID</th>     
                                   <th field="DIVISIONNA" width="100px">DIVISIONNA</th>
                                   <th field="GSF" width="60px">GSF</th>
         <th field="OPENED" width="100px">OPENED</th>
         <th field="TYPE" width="70px">TYPE</th>
         <th field="MALLNAME" width="200px">MALLNAME</th>
         <th field="MALL_GRADE" width="70px">MALL GRADE</th>                                  
         <th field="DISTRICT" width="150px">DISTRICT</th>
                                   <th field="MACYS_MALL" width="100px">MACYS_MALL</th> 
                                   <th field="WebLon_X" width="100px">WebLon_X</th>                
                                   <th field="WebLat_Y" width="100px">WebLat_Y</th>                              

Shortened code for putting into data grid:

var emptyCells = { items: "" };
var emptyStore = new{data: emptyCells});
   grid = dijit.byId('gridCE');

    //Put values in array for datagrid
     var attValues = resultFeatures[i].attributes;      

    var data = {
  identifier : "FID",
  label : "FID",
        items : dataForGrid

    var store = new{data: data});
 grid.setSortIndex(2,"true"); //sort on the state name