I started this as a reply to the thread about printing/saving a grid to CSV, but I'm not sure my problem is with that portion of my code. I have several grids that I'd like to save as CSV. In my non-AMD version, I had a dojo.forEach loop. The data each grid is processed into a string, which is the input to the function that does the actual saving.in pseudoCode
function exportGridCSV() {
//where qTaskNameList is an array of the names of all the grids I created
dojo.forEach(qTaskNameList, function(gridName) {
var gridData = dijit.byId(gridName+"_grid");
...
code to that takes the data from the grid, creates output string called inputData;
...
submitCSVPrint (gridName, inputData);
});
}
In this non-AMD version, the function loop processes each of my grids and I end up a dialog for "Save As" or "Open With" for each of the grids I processed in the dojo.forEach loop.In the AMD version, I can put log entries and it seems to be looping through each grid, but I only ever get one "Save As" dialog. I think this is maybe because I'm now in asynchronous mode?
function exportGridCSV() {
arrayUtil.forEach(qTaskNameList, function(gridName) {
var gridData = registry.byId(gridName+"_grid");
...
code to that takes the data from the grid, creates an output string called inputData;
...
submitCSVPrint (gridName, inputData);
});
}
Do I need to set up some sort of deferred for this? I didn't expect this behavior, I thought dojo.forEach and arrayUtil.forEach were more the same.