What is the use of "setLocation" method in the below code?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2015 10:39 PM
Hi, i have the below jelly code in one of the UI pages, not sure what is the use of this? especially the use of "setLocation" method?
Here i the "pageNumber" value will be 1 and finally grOffset will be equal to = 0 (zero) , then using the zero in setLocation will be like "current.setLocation(- 1)", what is the use of this?, where it sets "-1"??
I tried changing the value of this to current.setLocation(50), but found no changes in the results.
Thinking is it really required?
Any suggestions are most welcome.
Jelly code:
<j2:if test="${RP.getParameterValue('sysparm_page') != ''}">
<g2:evaluate var="jvar_page_number" jelly="true">
var pageNumber = RP.getParameterValue('sysparm_page') + '';
pageNumber = parseInt(pageNumber, 10);
if (isNaN(pageNumber) || pageNumber ${LT} 1)
pageNumber = 1;
var grOffset = (pageNumber - 1) * jelly.jvar_max_entries;
current.setLocation(grOffset - 1)
</g2:evaluate>
</j2:if>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2015 10:42 PM
we are using jelly.jvar_max_entries = 20
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2015 10:49 PM
It sets the current row location in a GlideRecord object - GlideRecord - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2015 11:41 PM
thanks, i have read this wiki page already. my doubt is why isn't the result table rows position getting changed if I change the value for "pageNumber"?? like i find no difference in the result table page with this script part removed.