Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying current value in Selection Cell GWT
    primarykey
    data
    text
    <p>I'm using a CellTable to display entities' information stored in the Datastore. Data type of the parameters are String and int. </p> <p>I decided to use SelectionCell to show the value of every parameter. This works perfectly when it comes to String data type, but it fails with int data type. </p> <p>For instance, I have a parameter called:</p> <pre><code>String name; </code></pre> <p>Possible values for this parameter are: "Name1", "Name2" or "Name3". I have these values in the SelectionCell, so if an entity has a parameter name = "Name2", SelectionCell displays "Name2"</p> <pre><code>List&lt;String&gt; names= new ArrayList&lt;String&gt;(); names.add("Name1"); names.add("Name2"); names.add("Name3"); SelectionCell nameCell = new SelectionCell(names); Column&lt;Entity, String&gt; nameColumn = new Column&lt;Entity, String&gt;(nameCell){ @Override public String getValue(Entity object){ return object.getName(); } }; cellTable.addColumn(nameColumn, "Name"); </code></pre> <p>Now, I have a parameter called:</p> <pre><code>int age; </code></pre> <p>Possible values for this parameter are: 18, 19, 20,... ,65. I have these values in the SelectionCell, but if an entity has a parameter age = 25, SelectionCell doesn't display that value, it displays 18.</p> <pre><code>List&lt;String&gt; ages= new ArrayList&lt;String&gt;(); for(int i = 18; i &lt;= 65; i++){ ages.add("" + i); } SelectionCell ageCell = new SelectionCell(ages); Column&lt;Entity, String&gt; ageColumn = new Column&lt;Entity, String&gt;(ageCell){ @Override public String getValue(Entity object){ return "" + object.getAge(); } }; cellTable.addColumn(ageColumn, "Age"); </code></pre> <p>How can I solve that?</p> <p>Cheers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload