Hallo friends,

working with fs1.2.1 and have the following problem/question.

Have a datasource with 10 rows per page and 105 records in the table. I have a button called "LastRecord" that use api_datasource.lastRow but the focus on the UI is still on a row on page 1. There is api_datasource.nextPage , but how i can jump to the page that contains the last row.

Does someone find a solution for that ?

Can a method called FirstPage and LastPage be implementent in future ?

Thanks Uwe K

asked 25 Jan '13, 04:19

Uwe%20K's gravatar image

Uwe K
1123
accept rate: 0%


Hi Uwe,

As you have mentioned, these two APIs are currently missing but we are planning to implement them for the version 1.2.3 .

In the meantime, you can use the following procedure to navigate to the last page of a datasource:

-- @param in_datasourceName_tx Name of the datasource
-- @param in_fetchMode_cd      Fetch mode of the datasource
procedure lastPage(in_datasourceName_tx varchar2, in_fetchMode_cd varchar2 := 'FetchAll') is
  v_lastPage_nr number;
  v_rowCount_nr number;
begin
  if in_fetchMode_cd = 'FetchAll' then
    v_rowCount_nr := api_datasource.getRowCount(in_datasourceName_tx);
  elsif in_fetchMode_cd = 'Paging' then
    v_rowCount_nr := api_datasource.getCompleteRowCount(in_datasourceName_tx);
  end if;
  v_lastPage_nr :=  ceil(v_rowCount_nr / api_datasource.getrowsperpage(in_datasourcename_tx));
  api_datasource.setpage(in_datasourceName_tx, v_lastPage_nr);
end;

If the rowsPerPage values of your datasources are not changing during runtime, you can define package constants holding the rowsPerPage values of your datasources to avoid the api_datasource.getRowsPerPage API call.

Also, please note that the api_datasource.setPage API sets the first row of the navigated page as the current row of the datasource. Therefore, you have to make the api_datasource.lastRow API call after this custom lastPage procedure.

Navigating to the first page is easier:

procedure firstPage(in_datasourceName_tx varchar2) is
begin
  api_datasource.setpage(in_datasourceName_tx, 1);
end;

Hope this helps,
Ibrahim

link

answered 25 Jan '13, 05:18

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Thanks, it works fine

link

answered 25 Jan '13, 06:35

Uwe%20K's gravatar image

Uwe K
1123
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1
×1
×1
×1

Asked: 25 Jan '13, 04:19

Seen: 685 times

Last updated: 25 Jan '13, 06:35

Related questions


© Copyright Gerger 2017