Sort details before building the table body