When Job id's exceed 9999, JobHistoryServer is not sorting properly based on the Job ID. It is mixing the jobs having > 9999 with other jobs considering only the first four digits of the job id. The same problem could exist for Job Map tasks and Reduce tasks table as well.
It is similar to the issue
YARN-3840 exists for YARN.