Edson Marcelo Posted March 18, 2021 Share Posted March 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
风吹小机机 Posted March 19, 2021 Share Posted March 19, 2021 Ask the same question You should control paging manually. I don't know if unidbgrid supports paging Now paging is based on the data loaded by the server. I don't know if I can do it Quote Link to comment Share on other sites More sharing options...
irigsoft Posted March 19, 2021 Share Posted March 19, 2021 I don't know if this will help, but see here: Or this: Or this: I think the latter is the most useful. has everything to navigate the pages 1 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted March 19, 2021 Share Posted March 19, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.