Question

I am using GWT's CellTable for a non-editable number cell, and it works fine. Is there a standard approach for an editable number cell?
If so, please provide some sample code.

Was it helpful?

Solution

Take a look at the HasCell interface. You could implement this interface and plumb it with a TextInputCell overriding the getCell, getValue and/or getFieldUpdater methods.

If your payload is a data transfer object with a Number field like BigDecimal then in the getValue method you'd just use String.valueOf(bd.doubleValue()), where bd is the BigDecimal instance. You might also consider using Google's NumberFormat to format the String. As for updating the DTO's field value , implement the getFieldUpdater method.

A complex example of what I'm talking about can be found here: Why are there no decent examples of CompositeCell in use within a CellTable?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top