That sounded promising, but it didn't help. I can put a console.log right before I call the function to submit the print and see that I have 4 different inputData strings corresponding with my 4 grids. Maybe my problem lies elsewhere. I have a form that I'm using to manage the call to the script that does the actual saving. I had to change it too to be in AMD format. I'm not familiar with forms, so maybe the change here is the problem. non-AMD - HTML
<div>
<form data-dojo-type="dijit.form.Form" method="post" action="" style="height: 0px; width: 0px; display:none;" class="dlform" id="downloadForm" target="_blank">
<input type="hidden" name="report" class="ri" id="reportinput" value="" />
<input type="hidden" name="filename" class="fn" id="filename" value="" />
</form>
<button id="btnExportGridCSVsubmit" dojotype="dijit.form.Button" onClick="exportGridCSV();"title="Save Search Results to CSV file">Save List</button>
</div>
function that executes on the click
function submitCSVprint(gridName, inputData) {
//opens the data in a hidden form used for printing and allows the user to either open or save the file.
var url = "webservices/csv.ashx";
var f = dojo.byId("downloadForm");
f.action = url;
dojo.byId("reportinput").value = inputData;
var distType = dijit.byId("distTypeSelect").value;
var distNum = dojo.byId("txtDistNumber").value;
dojo.byId("filename").value = distType+"Dist_"+distNum+"_"+gridName;
f.submit();
}
One of the things I had to do when I switch to AMD was put the action of the form in it's construction, it didn't like having it added as the action within a function. I was getting a 405 Server Error.AMD version - HTML
<div>
<form id="downloadForm" data-dojo-type="dijit/form/Form" method="post" action="webservices/csv.ashx" class="dlform" target="_blank">
<input type="hidden" name="report" class="ri" id="reportinput" value="" />
<input type="hidden" name="filename" class="fn" id="filename" value="" />
</form>
</div>
and the function
function submitCSVprint(gridName, inputData) {
var f = registry.byId("downloadForm");
dom.byId("reportinput").value = inputData;
var outFileName = setOutName(gridName);
dom.byId("filename").value = outFileName;
f.submit();
}
function setOutName (gridName) {
var distType = registry.byId("distTypeSelect").value;
var distNum = registry.byId("txtDistNumber").value;
var outFileName = distType+"Dist_"+distNum+"_"+gridName;
// console.log("outFileName is " + outFileName);
return outFileName;
}
Maybe the submit to a AMD dijit/form/Form behaves differently than the non-AMD version?I wish I had the hang of using gitHub, so I could post these there. I have these on our test server, which you should be able to get to. No guarantee that I haven't broken it worse before anyone gets a chance to look at it. non AMD version https://ogitest.oa.mo.gov/LEGIS/printExample/index.htmlAMD versionhttps://ogitest.oa.mo.gov/LEGIS/LegislativeAnalysis/index.htmlYou'll need to turn on some layers first and then do a search on a district number. The idea is to dynamically change what is queried and displayed. That part of working, but there's no way I'm going to get away with leaving out a print or save function.