Jump to content

Custom Js For Showing "record 1 Of 1" On A Details Page


Recommended Posts

When there is only one record found on the Details DataPage, users will not see a record counter screen of "Record 1 of 1". The counter only shows when there are at least TWO records to show:

 

post-20202-0-09138100-1458334302_thumb.j

 

I need to find a way to display "Record 1 of 1" when it is applicable.

 

Can anyone point me to the JS I would need to do this?

 

I know it's probably pretty simple, but I'm kind of a JS newbie and I didn't see this issue solved anywhere else on the forum.

Link to comment
Share on other sites

Hello Frank,

 

Welcome to the forum!

 

I have written the following script. You can add a Header&Footer element, select the Footer element, click the Source button and paste the code:

<script>
var myTables = document.getElementsByTagName("table");
var onlyOneRecord = true;
var navTable = "";
for (i=0; i<myTables.length;i++)
 {
   navTable = myTables[i].getAttribute("data-cb-name");
   if((navTable=="cbFormNavigationTableTop")||(navTable=="cbFormNavigationTableBottom"))
   onlyOneRecord = false;
  }
if (onlyOneRecord) document.write('<center><span class="cbFormNavigationCell cbFormNavigationMessage">Record 1 of 1</span></center>');
</script>

You can change the code <center><span class="cbFormNavigationCell cbFormNavigationMessage">Record 1 of 1</span></center> as you want.

 

I hope, it helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...