As we know, PHPMaker only displays the message "No records found" without including an empty table that associated with the data and the related fields. Sometimes, you want to display an empty table including the fields or columns name of the table in the page that contains that message (even there is no record in that table), so your web application users increasingly convinced that they are accessing the right page containing the data they need. This is very useful on the pages that display a table that does not have records at all in it. That condition is represented by the presence of an empty row in the table I mentioned earlier.
Another advantage from this modification is, it will have a direct impact on the search results pages that do not display any data/record. In addition to displaying the message "No records found" only, then your web application users will see below that message: a table including the fields or columns name, and a blank row that represents the condition that no records are found in the table. In other words, this empty table will help to ensure your users that they are seeing the page without any data/record in it, since the table has the fields/columns name.
All we have to do is customizing the PHPMaker template file. In other words, we do not modify any generated script files.
Please click on the following image below to watch the demo:

[hidepost]
-
Open your \Script\list-script.php file, and find this code:
<!--## If CTRL.CtrlID = "list" Then ##--> </form> <!--## End If ##-->
after the last line of that code, please insert this following code:
<?php // Begin of displaying empty table, by Masino Sinaga, December 22, 2011 ?> <div id="gmp_<!--##=gsTblVar##-->_empty_table" class="ewGridMiddlePanel"> <!--## If CTRL.CtrlID <> "grid" Then ##--> <!--## If bInlineAdd Or bInlineCopy Then ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs == 0 || $<!--##=gsTblVar##-->->CurrentAction == "add" || $<!--##=gsTblVar##-->->CurrentAction == "copy") { ?> <!--## Else ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs == 0) { ?> <!--## End If ##--> <!--## End If ##--> <!--## If iRecPerRow < 1 Then ' Single Column ##--> <table cellspacing="0" data-rowhighlightclass="ewTableHighlightRow" data-rowselectclass="ewTableSelectRow" data-roweditclass="ewTableEditRow"<!--##=ewCSSTableClass##-->> <?php echo $<!--##=gsTblVar##-->->TableCustomInnerHtml ?> <thead><!-- Table header --> <tr<!--##=ewCSSTableHeaderClass##-->> <?php // Render list options // $<!--##=sPageObj##-->->RenderListOptions(); // we do not need this since it is an empty table // Render list options (header, left) // $<!--##=sPageObj##-->->ListOptions->Render("header", "left"); // we do not need this since it is an empty table ?> <!--## For i = 0 to nFldCount-1 If GetFldObj(arFlds(i)) Then If CTRL.CtrlID = "list" And bBasicSearch And FIELD.FldBasicSearch And _ (FIELD.FldHtmlTag = "NO" Or FIELD.FldHtmlTag = "TEXT" Or FIELD.FldHtmlTag = "TEXTAREA" Or _ FIELD.NativeDataType = 247 Or FIELD.NativeDataType = 248) Then ' SET/ENUM P6 sSrchLegend = "<?php echo $Language->Phrase(""SrchLegend"") ?>" Else sSrchLegend = "" End If If iSortType > 0 Then sJsSort = " class=""ewPointer"" onmousedown=""ew_Sort(event,'<?php echo $" & gsTblVar & "->SortUrl($"& gsFldObj & ") ?>'," & iSortType & ");""" Else sJsSort = "" End If ##--> <?php if ($<!--##=gsFldObj##-->->Visible) { // <!--##=FIELD.FldName##--> ?> <?php if ($<!--##=gsTblVar##-->->SortUrl($<!--##=gsFldObj##-->) == "") { ?> <td<!--##=FieldTD_Header(FIELD)##-->><?php echo $<!--##=gsFldObj##-->->FldCaption() ?></td> <?php } else { ?> <td> <table cellspacing="0" class="ewTableHeaderBtn"<!--##=FieldTD_Header(FIELD)##-->><thead><tr><td><?php echo $<!--##=gsFldObj##-->->FldCaption() ?><!--##=sSrchLegend##--></td><td style="width: 10px;"></td></tr></thead></table> </td> <?php } ?> <?php } ?> <!--## End If Next ##--> </tr> </thead> <tr> <!--## For i = 0 to nFldCount-1 If GetFldObj(arFlds(i)) Then ##--> <?php if ($<!--##=gsFldObj##-->->Visible) { // <!--##=FIELD.FldName##--> ?> <td><div> </div></td> <?php } ?> <!--## End If Next ##--> </tr> </tbody> <!--## Else ' RecPerRow >= 1 (Multi Column) ##--> <table cellspacing="0" class="ewMultiColumnTable"> <!--## End If ##--> </table> </div> <?php } ?> <?php // End of displaying empty table, by Masino Sinaga, December 22, 2011 ?> -
The next step, we will customize the ScrollingTable extensions, so this empty table will still support for the scrolling table, especially if the table width is greater than the total width of your web application. Assuming you are a registered user of PHPMaker, so you have already had this extension; otherwise, just skip this step.
Open your \extensions\ScrollingTable\scroll.js file, and find this code://--> </script> <?php } ?> <?php } ?> <!--## End If ##--> <!--##/session##-->
before the first line of that code, please insert this following code:
ew_ScrollableTable(ewDom.get('gmp_<!--##=gsTblVar##-->_empty_table'), "<?php echo EW_SCROLL_TABLE_WIDTH; ?>px", "<?php echo EW_SCROLL_TABLE_HEIGHT; ?>px");Please note that those two constants above related to this modification. If you have not implemented that modification, then change the code become the following:
ew_ScrollableTable(ewDom.get('gmp_<!--##=gsTblVar##-->_empty_table'), "<!--##=sScrollWidth##-->", "<!--##=sScrollHeight##-->"); - Re-generate your .php files, especially the related list pages using your PHPMaker application.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.