In the previous exercise, you bound the employeesTable to the lightEmployeeRecordRows data object returned by the getLightEmployeeRecords() service in the Web service. Now you need to populate the details fields based on the employee that is selected in the table.
The JRowTableBinder that was used when you bound the table to the row data object simplifies this step. The JRowTableBinder exposes the selected element in the table as a separate data object that can be used as the parameter for the getFullEmployeeRecord(java.lang.Integer) method. You can then easily bind each of the text fields to its corresponding property in the selectedEmployeeRecord data object.
For example, if the employee record included a photo or an attachment, you would not want to retrieve all photos when you are simply getting the full list of employees. So, the getLightEmployeeRecord service is used to populate the table, and the getFullEmployeeRecord gets the full record for the employee who is selected in the table.
In this step you will bind the Last name field to the lastName property in the selectedEmployeeRecord data object:
To bind each of the remaining details fields for an employee, you follow a similar process as the last name field, but you do not need to add the data object. Because you already added the selectedEmployeeRecord data object, you can simply bind each field to its corresponding property in the selectedEmployeeRecord data object.
When you finish binding the text fields, the design area should look like the following image:
The employee ID field is disabled because the editable property on the field is set to false. However, the default behavior of the text field binder changes the enabled state on the field when the data object contains a value. You can turn off this binder behavior so that the field will remain in its initial read-only state.