View Pagination / View State

Hi all,

I have a $$ViewTemplate form, with an embedded view set to display using HTML

I have a Next and Previous button at the top of the view coded to use @DbCommand(“Domino”;“ViewPreviousPage”)

If I sort a column, and use the Next/Previous buttons, the view changes to the next or previous batch of documents correctly AND keeps the sorting state correctly.

However, if I click on any of the buttons I have made to jump to pages. ie I have a list of pages 1, 2, 3 and clicking on the 3 takes me to page 3, although the view displays the correct subset of documents, it does not keep the view state. ie it does not keep the sorting option, so when I click to sort again, it starts back at a.

Any idea how to tell the view to jump to page 3, or 2 and keep the sorting intack?

The code behind my 1, 2, 3 buttons is as follows. Thanks:

viewname := @If(@Elements(@ViewTitle)>1;@Subset(@Subset( @ViewTitle; 2);-1);@Subset( @ViewTitle; 1));

pagesexact := @Elements(@DbColumn(“”:“NoCache”;“”;viewname;2))/linesperpage;

pagesrounded := @Integer(pagesexact);

pagesremainder := pagesrounded - pagesexact;

pagetotal := @If(pagesremainder<0;pagesrounded+1;pagesrounded);

output := “1”;

@For(n := 2;

n <= pagetotal;

n := n + 1;

output := output + “&nbsp” + “”+ @Text(n) + “”);

output