Here's some code I used to create a progress bar for querying multiple layers. This code is old, but should give you an idea. When calling show(numParts), numParts is the number of layers. This will divide the progress bar into parts that will show each when each stage is complete. When a search is done on a layer, you can call update() which will change the progress bar to show how much of the operation is complete
var ProgressBar = function() {
var _id;
var _bar = dijit.byId("progressBar");
var _numParts;
var _progress;
var _show = function(numParts) {
if (numParts) {
_bar.update({ indeterminate: false, maximum: numParts, progress: 0 });
_progress = 0;
_numParts = numParts;
} else {
_bar.update({ indeterminate: true });
_progress = 0;
_numParts = 0;
}
dojo.style("progressBarContainer", "display", "block");
dojo.style("waitingDiv", "display", "block");
centerElement(dojo.byId("divMapTabs"), dojo.byId("progressBarContainer"));
};
var _hide = function() {
dojo.style("progressBarContainer", "display", "none");
dojo.style("waitingDiv", "display", "none");
};
var _update = function() {
_progress++;
_bar.update({ progress: (_progress) });
if (_progress >= _numParts) {
_hide();
}
};
return {
show: function(num) {
_show(num);
},
update: function() {
_update();
},
hide: function() {
_hide();
}
};
};