add sort functionality for table.