Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Navigate to First & Last Record

Questions related to using nuBuilder Forte.
Post Reply
Timo
Posts: 219
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Navigate to First & Last Record

Unread post by Timo »

HI guys,

Sometimes I would find it useful if there was a way to navigate directly to the first or last page. So you could add two additional icons, like this:
firstlastnav.png
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Navigate to First & Last Record

Unread post by kev1n »

Timo,

This code will add two additional icons - go to first and last record - to the navigator.

Add it under Setup -> Header

Code: Select all

function nuOnLoad()
{
	if (nuFormType() == 'browse')
	{
		var b = '<span id="nuFirst" class="nuBrowsePage"><i class="fa fa-step-backward" onclick="nuGetPage(0)">&nbsp;&nbsp;&nbsp;&nbsp;</i></span>';
		$(b).insertBefore("#nuLast");

		var lastPage = $('#nuBrowseFooter').text().match(/[0-9]+/g);
		b = '<span id="nuLast" class="nuBrowsePage">&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-step-forward" onclick="nuGetPage(' + lastPage + ')"></i></span>';
		$(b).insertAfter("#nuNext");
	}
}

nav.gif
You do not have the required permissions to view the files attached to this post.
Timo
Posts: 219
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Navigate to First & Last Record

Unread post by Timo »

Amazing Kevin, thank you!!
admin
Site Admin
Posts: 2822
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Navigate to First & Last Record

Unread post by admin »

.
hering
Posts: 10
Joined: Sun Apr 09, 2023 12:54 pm
Has thanked: 8 times
Been thanked: 1 time

Re: Navigate to First & Last Record

Unread post by hering »

Hi.
I found a bug. Perhaps there has been a change in the code since 2019.

Old: nuGetPage(0)
New: nuGetPage(1)

Code: Select all

function nuOnLoad()
{
	if (nuFormType() == 'browse')
	{
		var b = '<span id="nuFirst" class="nuBrowsePage"><i class="fa fa-step-backward" onclick="nuGetPage(1)">&nbsp;&nbsp;&nbsp;&nbsp;</i></span>';
		$(b).insertBefore("#nuLast");

		var lastPage = $('#nuBrowseFooter').text().match(/[0-9]+/g);
		b = '<span id="nuLast" class="nuBrowsePage">&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-step-forward" onclick="nuGetPage(' + lastPage + ')"></i></span>';
		$(b).insertAfter("#nuNext");
	}
}
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Navigate to First & Last Record

Unread post by kev1n »

Hi,

This function is already incorporated into nuBuilder, and the issue was already fixed some time ago.

Code: Select all

nuAddBrowseAdditionalNavButtons();
Post Reply