Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get selected record position after sorting in limit-table browser?

Status
Not open for further replies.

RbgoWeb

Programmer
Apr 10, 2002
91
NL
In a table browse control with [first] [prev] [next] [last] buttons and a LIMIT setting, the records in a db table are devided and browsed in virtual pages.

In the GUI for these pages a record can be selected, and columns can be sorted.

When I sort with a record selected, changes are big that the record ends op on a page that is currently not displayed. And I like to switch to that page automatically so the selected record remains in view.

My question:
How can I find out what the selected record position or number would be, after sorting the table's total data?
Then I can calculate on what page the record is after sorting en adust this in the table browse control.
 
Well you might be able to do that, but let me suggest a different approach.

Keep track of the id of the selected record, not its position in the sort but its unique record id. Then move to the group of records containing that id and display that group.

What do you mean by "... the records in a db table are devided and browsed in virtual pages..."? Records in a db table dont have any meaningful order, nor are they divided and browsed in virtual pages. These thing happen in your application, possibly a web page generated by a CGI script which retrieves records. The records may be sorted; you may retrieve more records than you display; the script may have a procedure for dividing the records into groups; but arent the records all available to the script to be examined prior to building the display? If so, then you can find the record with the selected id and display the group it is in. Right?
 
Thanks for reply rac2. I submitted the same question in phpforum. Came up with a solution and put it on the page in PHP forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top