javascript - manipulating a Play controller parameter in a template -


in play app(java) have table different columns, if user clicks on title of each column, table sorted based on column. each time user clicks on it, sorting should change "asc" "desc" , vice versa.

i need solution this: each time user clicks on link, order changes "asc" "desc" , vice versa. , controller should called.

<a href="@routes.application.changeorder(order)">test</a> 

is possible write scala function inside template this? or how javascript?

you can use if-clause:

@if(order.equals("asc")){   <a href='@routes.application.changeorder("desc")'>test</a> } else{   <a href='@routes.application.changeorder("asc")'>test</a> } 

Comments