AnsweredAssumed Answered

Trying to renderCell with images based on timestamp in epoch time

Question asked by mrogers83 on Apr 10, 2014
Latest reply on Apr 14, 2014 by mrogers83
I am trying to use renderCell in dgrid to show whether a certain vehicle is transmitting or not.  We have a TimeStamp field, but the time coming in from the GPS unit is epoch time.  I have done a formatter and can get the time to come in correctly, but we don't really want the date and time to show on the grid.  We want an image of a green circle to show if the timestamp is the current time, and a red circle to show if the timestamp is not the current time(so that we know when a gps unit is possibly malfunctioning and so that others looking at the screen know that the position may not be accurate).  This is the code I have come up with so far for the renderCell:

function transmittingRenderCell(object, value, cell, options){  var greenLight = new Image();  greenLight.src = "images/greenLight.png";  var redLight = new Image();  redLight.src = "images/redLight.png";  var inputDate = new Date(value);  return;  var currentDateTime = new Date();  //var day = currentDateTime.getDate();  //var month = currentDateTime.getMonth()+1;  //var year = currentDateTime.getFullYear();  //var hours = currentDateTime.getHours();  //var minutes = currentDateTime.getMinutes();  //var date = month + "/" + day + "/" + hours + ":" + minutes;  if(inputDate = currentDateTime){   return greenLight;  }  //else{   //return redLight;  //} }

It took me awhile to come up with the code to get the currentDateTime, so any help in figuring this out is appreciated.