I have script that displays a list of employees with their last known location in the warehouse. Unfortunately, it does not sort the names alphabetically; consequently, for a long employee list, it gets messy. Employee Data are stored like this in the js file:
var _Employees = {
"%EmployeeID%" : "%login% |%Name%,%Surname%",
"%EmployeeID%" : "%login% |%Name%,%Surname%",
"%EmployeeID%" : "%login% |%Name%,%Surname%",
"%EmployeeID%" : "%login% |%Name%,%Surname%",
"%EmployeeID%" : "%login% |%Name%,%Surname%",
};
DrawContent Function:
function DrawContent(){
var aa = '<table id="Results"><tr><th>Surname, Name</th><th>Last Scan</th><th>Last Activity</th><th>Workstation</th></tr>';
$.each(_Employees, function(_employeeId, _employee){
var _employeeName = _employee.split('|')[1];
aa += '<tr class="aa_' + _employeeId + '">';
aa += '<td>' + _employeeName + '</td>';
aa += '<td></td>';
aa += '<td></td>';
aa += '<td></td>';
aa += '</tr>';
});
aa += '</table>';
$('#mydiv').append(aa);
}
Could someone assist and provide me a quick and simple solution to list the names in alphabetical order?
Thanks!