Im aware a sort() function exists, just not sure where it should be placed in my code. I have a function that draws routes on the map and i'm getting my results that are in my table from those routes. Do I put sort() after the lines are drawn, before the table is populated? or after the table is populated. Here is my code that populates my table.
myMap.Search = {
gpGetStats: new esri.tasks.Geoprocessor(gpURL),
getRouteStats: function () {
console.log(dojo.byId('resultsLayer').value)
var params = {
"ZIP_CRID": dojo.byId('resultsLayer').value
};
resultsLayer.Search.gpGetStats.execute(params, resultsLayer.Search.handleStats);
},
handleStats: function (results, messages) {
console.log(results);
// content.sort();
var content = "";
content += '<table>';
content += '<tr><td> ZIP CRID </td><td> Bus </td><td> Res </td><td> Tot </td><td> <200 </td><td> DS Key </td></tr>';
dojo.forEach(results[0].value.features, function (crid, i) {
console.log(crid.attributes.ZIP_CRID + ', ');
content += '<tr><td>' + crid.attributes.ZIP_CRID;
content += '</td><td> ' + crid.attributes.BUS_CNT;
content += '</td><td> ' + crid.attributes.RES_CNT;
content += '</td><td> ' + crid.attributes.TOT_CNT;
content += '</td><td> ' + crid.attributes.LT_200_IND;
content += '</td><td> ' + crid.attributes.DS_KEY + '</td></tr>';
});
content += '</table>';
dojo.byId('details').innerHTML = content;
},
}
Also a Dojo Grid would be acceptable