Datasource and business logic are used the same as before. New features of extended sample - EditableTable.zip:
- Table is read-only, however newly created row is shown in edit mode
- Editing for selected row is enabled
- Delete operation is added
After 'Save' button is pressed, newly entered row is stored in the database:
Second feature - selected row editing. To enable row editing I have used technique described in Frank Nimphius's blog - ADF Faces: Conditionally disabling an af:tableSelectOne row for selection. You should create ActionListener for Edit button, created ActionListener will store selected row ID into managed bean atttribute - enableEditing. Managed bean method code for enableEditing attribute, this code compares current row with selected row:
For each af:inputText component contained in af:column, change ReadOnly property value to #{row.JobId != null && !valueHolder.enableEditing}. Edit functionality:
Delete operation is developed by making simple drag-and-drop from Data Controls pallete to ADF Faces af:table component.
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.
0 comments:
Post a Comment