On 2 July 2012 16:21, BlueShadow <kevin.bet...@gmail.com> wrote: > Hi I got a table called Articles which contain the nuber of views and the > date when they where written. I Sorted them in the default.py by the views > and by the date. I Show them Sorted by Date on my index page. Now I like to > add a button to switch from the one to the other. > By default it should be ordered by date. > I got no Idea how I can achieve this can anyone help? > > If you are using SQLFORM.grid or SQLFORM.smartgrid, you can click on the column header to sort the data according to that column.
If you want a button, just build a button which refers to a function that changes the 'orderby' part of your query, run the query and redisplay the data. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)