You will need to adjust the code in _ScriptLibrary/DATAGRID.ASP
In the Display method (function _DG_display(bReturnText)
), find this block:
if (this.hasPageNumber)
{
strHTML += '<TD align=right valign=middle>';
strHTML += '<FONT size=2><NOBR>' + String(curPage+1) + ' / ' + parseInt(nPages) + '</NOBR></FONT>';
strHTML += '</TD>\n';
}
strHTML += '</TR></TABLE>\n';
Amend the bold line with the required format.
A better method would be to set a Template string, that would allow the datagrid to change formatting in a more flexible manner:
1. Add a property to the DataGrid.asp, (here called strPageFmt).
function _DataGrid(strName,objParent)
{
// public members
this.id = strName;
this.strPageFmt = "%page% of %pages%";
{1.1 OR have an array of standard formats}
2. Adjust the code as listed above to replace %page% with the String(curPage+1) value, and the %pages% with the parseInt(nPages) value.
var strPage = "";
strPage = this.strPageFmt.replace(/%page%/ig, String(curPage+1));
strPage = strPage.replace(/%pages%/ig, parseInt(nPages))
strHTML += '<FONT size=2><NOBR>' + strPage + '</NOBR></FONT>';
(or something like that! (first parameter is a regular expression, and the % may need to be escaped))
3. In your page code (thispage_onenter), set the required format string:
grdMyGrid.strPageFmt = "Now Showing <b>%page%</b> of %pages%".
VI will NOT pop-up this new property, but it should work.
NOTE: unless this format string is set on every page refresh, it will revert back to the default format that you set in step 1 above. Remembering these settings is what the preserveState/restoreState methods are meant to achieve - so see if you can figure out the required code!
Exercise: See if you can create a list of page links too. So grid pages 1 to 10 (for example) are listed as links, rather than just the Next/Prev buttons.