Jump to content

Manual Paging with UniDBGrid


Edson Marcelo

Recommended Posts

Hello Guys, help please:
I have the following scenario:
- Firebird
- Table with 1 million records, for example.
- if, I select * from table, 1 million records will be loaded on the server
- on the client, UniDBGrid, using pagination, will paginate, by default, 25 records per page.

In this scenario, the customer will browse the data normally.
But before displaying the first 25 records in this table, the server loaded 1 million records.

I want to relieve the server by optimizing the query:

example: for example with pagesize = 10

First 10 records (page 1)
SELECT FIRST 10 SKIP 0 * FROM TABLE
+10 records (page 2)
SELECT FIRST 10 SKIP 10 * FROM TABLE
+10 records (page 3)
SELECT FIRST 10 SKIP 20 * FROM TABLE
  
doing this way unburden the server.

In UniDBGrid I can already do the first part, that is, page 1 is ok. I used the onRecordCount event to set the total number of records in the table (1 million).
And he creates the pages as expected.

The problem is when I press to go to the next page. What event would you use, in this case to be able to get the current page so I can redo the query for
bring more records. To do this, you would need to capture the current page number of the UniDBGrid. Does anyone know how to do this?

In short, I need to do the paging manually.

sorry for the text size, but it is to be as clear as possible.

Link to comment
Share on other sites

this is it (I think):

http://forums.unigui.com/index.php?/topic/11573-unidbgrid-current-page/&tab=comments#comment-61419

 

'"To do this, you would need to capture the current page number of the UniDBGrid. Does anyone know how to do this?"

Calculate curent page: 

CurrPage = UniDBGrid1.DataSource.DataSet.RecNo div UniDBGrid1.WebOptions.PageSize + 1

 

"In short, I need to do the paging manually."

Go to page ID:

"In JS I've seen that UniSession.AddJS(UniDBGrid1.JSName+'.store.loadPage(1);'); is working, ..."

 

To do paging manuаlly, You can hide pagepanel (custom css) and add own buttons for next /prev page

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...