Page 1 of 1

Navigate to First & Last Record

Posted: Thu Oct 17, 2019 5:39 pm
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

Re: Navigate to First & Last Record

Posted: Fri Oct 18, 2019 2:22 am
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

Re: Navigate to First & Last Record

Posted: Tue Oct 22, 2019 9:11 am
by Timo
Amazing Kevin, thank you!!

Re: Navigate to First & Last Record

Posted: Tue Oct 22, 2019 11:51 pm
by admin
.

Re: Navigate to First & Last Record

Posted: Sun Aug 27, 2023 12:16 am
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");
	}
}

Re: Navigate to First & Last Record

Posted: Sun Aug 27, 2023 4:44 am
by kev1n
Hi,

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

Code: Select all

nuAddBrowseAdditionalNavButtons();