PHPMaker generates the Master/Detail pages by including the *master.php file into the generated List page that belongs to the detail table. For example, the master table is orders, and the detail table is orderdetails and both tables have already been associated as Master/Detail in Table setup of PHPMaker. So, in the generated orderdetailslist.php file, you will see the code which includes ordersmaster.php inside that orderdetailslist.php file (using PHP include_once command).
In addition, there is no Server Events provided in PHPMaker, thus we cannot customize the fields in the Master section of that Master/Detail pages by using Server Events as well as the normal List pages. Even we cannot use the Server Events that belongs to the master table itself in order to hide the fields by assigning the Visible property of the field become FALSE, since the master section in the detail list page uses PHP include_once command.
On the other side, I recently wanted to hide or customize the certain fields in the Master section that located at the top of the Master/Detail pages. To overcome this issue, now I will show you how we can hide the fields in the Master section of that Master/Detail pages. We will not customize any generated script files for this. We will write a little of jQuery code in the Client Scripts section of PHPMaker.
[hidepost]
- Run your PHPMaker project (.pmp) file using PHPMaker.
- Go to Tools -> Advanced Settings and then make sure you have already given a checked mark at the Local YUI/jQuery files. I recommend this setting, especially if your web application will not connect to the Internet to use the live YUI/jQuery files.
- From the example above, click on orderdetails table in the Database pane in the left side of your PHPMaker. In other words, we will customize from the detail table side, not from the master table side.
-
Let' say we want to hide a field named status that located at the Master section in that Master/Detail page. To do this, go to the Client Scripts -> Table-Specific -> List Page -> Startup Script, then insert the following code:
$(document).ready(function(){ $('#r_status').hide(); });
As you can see from the code above, the ID of status field is generated by PHPMaker by adding the prefix r_ since it is a TR (Table Row) tag of the Master table section in the Master/Detail page. Please note that this trick will not affected to the Master/Detail Export pages. In other words, the status field at the Master section will be displayed (won't be hidden).
- Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
Anthony Percivalle says
Trying to hide an entire column , what would be the way to do that? I cant seem to find any info on that.
Masino Sinaga says
This article is related to PHPMaker version 9 only. Are you sure you are using that version, too? If not, then this may not work in the latest version of PHPMaker.