After customizing the PHPMaker template files in order to display the record or row number in the List pages and also in the Exported List pages, then it's time also for us to display the record number in detail preview row page. We are going to customize the extension file that related to the functionality for displaying list of record. In this article, I will show you how we can customize the previewrow extension easily and quickly.
But, before doing that, please make sure you have already implemented the customization I made in that two articles above, since there are some changes that depend on the customization in those two articles. Not only that, you will get many advantages after implementing the record number customization, as this will help your users to identify the records in the page that contains the records list or table.
After implementing this customization below, then you will see a new column appears in the detail preview row. This new column sits at the most left of the preview list, that contains the record or row number. This is very useful and helpful, if you want to display the record or row number when your users are expanding or displaying the detail preview row of the certain master record, which is you made by using the help of previewrow extension. The other advantages you will get is, this customization can be implemented also to the similar extension, yuicontainer. Sounds promising, eh?
In this example below, I was using the PreviewRow extension. If you have not used it, yet, then it's time for you to use it! Go to PHPMaker, click on Tools -> Extensions, and then make sure you have already given a checked mark at the PreviewRow item under the Type: Details Preview section. If this is the first time you use this extension, then try to generate your script files using PHPMaker to extract the files from the .zip file to your template. Let PHPMaker do this automatically while generating your script files.
Updated on September 5, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 29, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 10, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: The customization has been handled by using MasinoPreviewRow extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
[hidepost]
-
Open your \Script\ewcfg.php file, and find this code:
// General
before that line, please insert the following code:
// Begin of modification Record Number on Detail Preview List Pages, by Masino Sinaga, November 29, 2012 define("MS_SHOW_RECORD_NUMBER_COLUMN_ON_DETAIL_PREVIEW", TRUE, TRUE); // End of modification Record Number on Detail Preview List Pages, by Masino Sinaga, November 29, 2012 -
Open your \extensions\PreviewRow\preview-script.php file, and find this code:
<tr<!--##=ewCSSTableHeaderClass##-->>
after that line, please insert the following code:
<?php if (MS_SHOW_RECORD_NUMBER_COLUMN_ON_DETAIL_PREVIEW) { ?> <td style="text-align: center;"><?php echo $Language->Phrase("RecNo"); ?></td> <?php } ?> -
Still in that \extensions\PreviewRow\preview-script.php file, find again this code:
while ($<!--##=sPageObj##-->->Recordset && !$<!--##=sPageObj##-->->Recordset->EOF) {then replace it with the following code:
$rowNumber = 0; while ($<!--##=sPageObj##-->->Recordset && !$<!--##=sPageObj##-->->Recordset->EOF) { $rowNumber++; -
Still in that \extensions\PreviewRow\preview-script.php file, find again this code:
<tr<?php echo $<!--##=gsTblVar##-->->RowAttributes() ?>>
after that line, please insert the following code:
<?php if (MS_SHOW_RECORD_NUMBER_COLUMN_ON_DETAIL_PREVIEW) { ?> <td style="text-align: center;"><?php echo $rowNumber; ?></td> <?php } ?> -
Still in that \extensions\PreviewRow\preview-script.php file, find again this code:
<tr<!--##=ewCSSTableFooterClass##-->>
after that line, please insert the following code:
<?php if (MS_SHOW_RECORD_NUMBER_COLUMN_ON_DETAIL_PREVIEW) { ?> <td style="text-align: center;"> </td> <?php } ?> - Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.