Two Tables, Master and Detail

 

 

         For our client "goodclient" we are doing a portlet project called "xmlpfexampleM" where we want to create a users table maintenance, where there are two fields one is the "userName" and the other is the "userTypeId", and we want to validate "usersName", the thing here is that we want to account all vehicles of each user. For that he provide another table called UserVehicles, where we will store vehicles for each user.

 

        In this case, we also have to define two <application> in our xml and conect one table with the other table  using <detailFile> tag. In this generation you will also observe that the ".war" file contains two portlets, one for each <aplication> defined.

 

         This is how the portlets will look in the page with Liferays Classic theme. We put the master file Users, to the left and de detail file Vehicles to de right. Observe that when we enter in the page, and no record of the master (user) file is selected. nothing appears in the detail file, nothing can be done.

        Now we are going to select first record (id=606, Jack A. Rider) by clicking small icon to the left. It will result in this:

 

         Now that the portlet knows which user you are talking about, it will let you add vehicles to it. This is normal porltet behaviour as you seeen before:

 

          Resulting in something like this:

 

         Now if we select other user, it will show its vehicles (none in this case).

 

          Here you have the full XMLPortletFactory xml file.

XMLPFExample13.xml

          And here you have the portlet war generated. (for liferay 6.0.6)

xmlpfexampleM-portlet-6.0.6.1.war

          If you want to use this example you can follow instructions here DOCUMENTATION