how to avoid 'null' string when table is in edit mode?

Hi All,

I have a table and a datasource container (BeanItemContainer). I am populating the container with data from the database. The table is showing data correctly when it is in readonly mode.


Problem :
I have an edit button to bring the table in edit mode. When I click the button, cells having null values are showing the string ‘null’. Having ‘null’ in UI does not look good.

How can I avoid getting ‘null’ string? My concern is, the solution should not replace the null value in database with empty string. Is it possible? Please help. If my problem is not clear then please let me know.

Hi,

The DefaultFieldFactory does indeed show the null values as-is, so you need to create a custom one. Do the following:

  1. Create a new class implementing the TableFieldFactory interface
  2. Provide the TextFields from there and call TextField.setNullRepresentation(“”) for them
  3. Add your factory to the Table by calling Table.setTableFieldFactory(yourFactory).

-tepi

Thank you Tepi… I will try to implement your solution. thank you once again.

Than you Tepi… It worked, but my factory class is extending DefaultFieldFactory and in table constructor I am doing setTableFieldFactory.