Pagination and page summaries

Dear yiizards,

In a paginated gridview, I’d like to add a header row with the situation of previous pages.

Imaging a bank account, with numerous withdrawals and deposits. 10 operations are listed per page, but at the top of the page, before the first line, in the header of the grid view, I’d like to add a line with the situation of the previous pages.

I know how to put static content in headers or footers, but how can I add dynamic content based on page number and page size?

In a gridview header, can I (and how can I) access, let us say, the first model displayed on the first line?

At worst, how can I know the order number of the model (based on page number and page size), and redo a query to fetch the model knowing its order number?

Thank you for your help.

P.