Carrie,
If you are just getting into JS development then this may be pretty hard but this is how I export data to a csv from inside a widget:
define([
...
'jimu/CSVUtils',
...
],
function (
...
CSVUtils,
...
) {
return declare([BaseWidget, _WidgetsInTemplateMixin], {
currentCSVResults: null,
var csvRow = {}, csvColumns = [];
csvColumns.push(your attribute name);
csvRow[your attribute name] = "the value of that attribute";
csvData.push(csvRow);
this.currentCSVResults = {
data: csvData,
columns: csvColumns
}
CSVUtils.exportCSV("the name of your layer", this.currentCSVResults.data, this.currentCSVResults.columns);