For a scenario where you want to hide the newly created table rows which are not yet committed to the database:
Suppose we have an input form which lets us add a new employee and there is a table which displays all the employees. When we add a new employee using the input form a new row also gets added into the table. We may not want to display this new row until all the fields have been entered and the new employee data has been committed to database. To avoid displaying this new row in the table:
1. Create a transient attribute in the entity object and use it to identify whether the row is new by checking its entity state
2. In the table bindings check Enable Filter and use the transient attribute as a filter. Use the filter value which corresponds to non new rows
Now only the rows which are fetched from the database and are not new will be displayed on the page
Suppose we have an input form which lets us add a new employee and there is a table which displays all the employees. When we add a new employee using the input form a new row also gets added into the table. We may not want to display this new row until all the fields have been entered and the new employee data has been committed to database. To avoid displaying this new row in the table:
1. Create a transient attribute in the entity object and use it to identify whether the row is new by checking its entity state
public String getNewRow() { if(this.getEntityState() == Entity.STATUS_NEW){ return "Y"; } else{ return "N"; } }
2. In the table bindings check Enable Filter and use the transient attribute as a filter. Use the filter value which corresponds to non new rows
Now only the rows which are fetched from the database and are not new will be displayed on the page
<< A Request >>
Please contribute in making this world a better place to live in by adopting a pet from your nearest pet shelter (btw cats are my favourite :-) )
<< Thank You >>
Please contribute in making this world a better place to live in by adopting a pet from your nearest pet shelter (btw cats are my favourite :-) )
<< Thank You >>