Hi Formspider team,

Case: i have a grid with paging. I query the grid, so the datasource currentrow is the first record in the grid, so its on page 1. Now i go to page 2 or 3 or whatever using the paging buttons. The grid current row still is on page 1 (or whatever page it was when i started navigating through the grid pages). Now i create a new row in the grid (it places the new row after the datasource current row automtically). I dont see that happening, because the current row is on another page...

What i want to do is to set the grid page number to the page where the current row is on insert (with api_datasource.setPage), so that i can see the record that was inserted.

But, how can i get the page number of the current row in the grid?

Thanks, Michiel A.

asked 28 Aug '12, 08:32

Michiel%20A's gravatar image

Michiel A
accept rate: 13%

edited 28 Aug '12, 08:33

Hi Michiel,

According your description, I assume that the fetch mode of your datasource is "fethAll". If so, you can find the page number where the new row is inserted as follows;

ceil(api_datasource.getRowNumber(yourDatasourceName, newRowID) / api_datasource.getRowsPerPage(yourDatasourceName))

if the rowsPerPage value of the datasource is not changing during runtime, you can define a global variable holding the rowsPerPage value of your datasource to avoid the api_datasource.getRowsPerPage API call.

Hope this helps.


answered 28 Aug '12, 11:54

Ibrahim%20Sandalli's gravatar image

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

Hi Ibrahim,

Yes, that will do the trick. The rowsPerPage will not change for the form, so i could make a form package constant to avoid the api call.

Thanks, Michiel


answered 28 Aug '12, 12:05

Michiel%20A's gravatar image

Michiel A
accept rate: 13%

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 28 Aug '12, 08:32

Seen: 1,257 times

Last updated: 28 Aug '12, 12:05

© Copyright Gerger 2017