Adding an editable numeric cell to celltable

1.6k views Asked by At

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.

1

There are 1 answers

0
Chris Phillipson On BEST ANSWER

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?