sort table with template column