Jump to content

Paging Stored Procedure with TUniDBGrid?


cocoa.zhao

Recommended Posts

Hi Guys,

 

Is there a way to customize the paging operation?
I don't want to load all the records in a TDataSet.

What can I do to get the page I need only, and with the paging toolbar working still?

 

Thanks in advance!

Link to comment
Share on other sites

TDataSet paging is implementation-specific.

 

For instance, if you are using ODAC TOraQuery (like I do) you set

TOraQuery::FetchAll = false

TOraQuery::FetchRows= <desired number or rows>

 

Still, the uniGUI paging does NOT work well with paged queries, because it "pages" only the rows actually fetched (otherwise how can it tell you the total number of pages in advance?), and for what I have seen, once you reach the end of the page it doesn't fetch the next page. So, I'd suggest you to implement your own implementation-specific PageBar Frame.

Link to comment
Share on other sites

Query and grid initialization

_query->FetchAll = false;
_query->FetchRows = _pagesize;
_grid->WebOptions->Paged = true;
_grid->WebOptions->PageSize = _pagesize;
_grid->WebOptions->FetchAll = false;

	// hide uniGUI pagebar
_grid->ClientEvents->ExtEvents->Values[L"afterrender"] = L" function(sender,eOpts)\
{\
	if (sender.dockedItems.items[1])\
		{sender.dockedItems.items[1].hide();}\
}";

After this, you need to manually implement all the buttons to go to next page, previous page, first page....

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...