Submit in .jsp file not ‘seeing’ dijit.byid tabs in associated Dojo/.js file

I have an index.jsp file that includes:

<input type="submit" class="button" id="exportGrids" value="Export Grids" />...

   <div>
    <div class="tabPane" title="User Inbox" id="userInboxTab">
     <div class="inboxTable" id="userInboxGrid></div>
    </div>
    <div class="tabPane" title="Groupbox Inbox" id="groupInboxTab">
     <div class="inboxTable" id="groupInboxGrid></div>
    </div>
   </div>

and a related Dojo/ index.js file comprising two tabs:


    on(dom.byId("exportGrids"), "click", function(){
        var exportData;
        
        dijit.byId("userInboxGrid").exportGrid("csv", function(gridData) {
            exportData = gridData;
            dom.byId("exportData").value = exportData;
        });
        
        dijit.byId("groupInboxGrid").exportGrid("csv", function(gridData) {
            exportData = gridData;
            dom.byId("exportData").value = exportData;
        });
        
        return true;
    });

Regardless of which tab is highlighted when the submit is clicked the exported csv only seems to ‘see’ the ‘User Inbox’ tab’s tabled data (coming sequentially first in the code?). I’ve tried several variations of the above code without success. Because it’s mostly successful it can’t be too far off from exporting either the User or Groupbox data depending on what tab is presently in play.

Any help/insight with this one would be greatly appreciated. It’s driving me nuts!! 😉