dimanche 15 mars 2015

Spring sorting table by clicking on column header

I would like to ask for your help. I got simple html table, which gets data from Repository (extends JpaRepository). Atm I got simple pagination and sorting via lastName. I would like to sort table by clicking on column headers so for example I could sort data by price or address. Thank you for any suggestion.



@RequestMapping(value = "/list", method = RequestMethod.GET)
public String userList(
Model model,
@PageableDefault(page = 0, size = 50, sort = "lastName", direction = Direction.DESC) Pageable pageable) {

model.addAttribute("page", userService.findAll(pageable));
return "user/list";
}

Aucun commentaire:

Enregistrer un commentaire