AnsweredAssumed Answered

Problems with loadingMessage and noDataMessage in OnDemandGrid

Question asked by mrogers83 on Apr 10, 2014
Latest reply on Apr 10, 2014 by mrogers83
I have a grid that is populating from a query and queryTask using specific parameters.  I want my OnDemandGrid to show a loading message and a no data message, which I understand can be done inside the code for creating the OnDemandGrid.  For some reason when I do it this way, the message for noDataMessage comes into the grid at the bottom of the results when they are there, but nothing comes into the grid while the user is waiting for the data to populate.  Here is the code for my creation of the grid along with the queryTask and query that are associated with it.  I did not add in any css for the messages.

function execute() {
 var queryTask = new QueryTask(window.historicalUrl);
 var timeExtent= new TimeExtent();
 timeExtent.startTime=new Date(dom.byId("date").value);
 timeExtent.endTime=new Date(dom.byId("date2").value);
 var query = new Query();
 query.returnGeometry = false;
 query.outFields = window.historicalOutFields;
 query.text = dom.byId("mydropdown").value;
 query.timeExtent = timeExtent;
 queryTask.execute(query, function(results) {
   var data = [];
   var data =, function(feature) {
    return {
     //property names used here match those used when creating the dgrid
     "Velocity": feature.attributes[window.historicalOutFields[0]],                  
     "SpeedLimit": feature.attributes[window.historicalOutFields[1]],                  
     "StreetName": feature.attributes[window.historicalOutFields[2]],
     "TimeStamp": feature.attributes[window.historicalOutFields[3]]
  var memStore = new Memory({ data: data });
  //create historical data dgrid
  window.grid3 = new (declare([OnDemandGrid, Selection]))({
   bufferRows: Infinity,
   maxRowsPerPage: 5000,
   columns: {         
    "Velocity": { "label": "Speed (MPH)", "formatter": dojoNum.format },
    "SpeedLimit":{"label": "Speed Limit", "formatter":dojoNum.format},
    "StreetName": "On Street",
    "TimeStamp": {"label": "Last Contact", "formatter": formatTimestamp}
   loadingMessage: "Loading data...",
   noDataMessage: "No results found."
  }, "grid3");
  grid3.set("sort", [{attribute:"TimeStamp", descending:true}]);
  //window.grid3.set("store", memStore);

Any help is much appreciated, thanks!