Export featureTable to CSV

8758
11
04-21-2016 09:17 AM
DonCaviness
New Contributor III

I'm using the featureTable dijit in my application. I am able to populate the table based on different featureLayers in the map. I would like to be able to export the table to a CSV file the user can download.  The number of features in table can be any where from less than 10 to upwards of 10,000.  Is there any samples or known ways to export the featureTable to CSV?  I have tried several things but have been unsuccessful.

0 Kudos
11 Replies
DonCaviness
New Contributor III

Only issue I'm seeing is what Rene pointed out about only exporting what has been downloaded.  This is something I need to get around.  For example if I have a table with 2793 records, only the first 1000 get exported.  Now if i scroll through the table, then all 2793 records get exported because now all records have been downloaded to the client but that is something I can't ask the user to do each time when they want to export the table.  How can I get around this using this method?

0 Kudos
DavidChrest
Occasional Contributor II

I ran into this same kind of thing a while back when creating a dgrid to show my selection. I found the solution here: Custom Feature layer on loading on dgrid .

It's basically this on line of code when you construct you construct/initialize/create your dgrid/attribute table.

bufferRows: Infinity,

This allows all rows to be loaded without having to scroll down to do so.

Not sure how this would get inserted into the Feature Attribute code but here is what I do when I create my attribute table using dgrid:

//Initialize the Activities grid
  var gridActivitiesDay1 = new(declare([OnDemandGrid, Selection]))({
  bufferRows: Infinity,
  columns: {
  OBJECTID: {
  label: "GPSid"
  },
  Day1Date: {
  label: "Day"
  },
  TimeofDay: {
  label: "Time"
  },
  Latitude: "Latitude",
  Longitude: "Longitude"
  }
  },
  "divGridActivities");

If you can't do this with the Feature Attribute Table widget, setting "Maximum Number of Records Returned by Server" to 3,000 would work?

0 Kudos