Note that there are some explanatory texts on larger screens.

plurals
  1. POEditTextCell FieldUpdater width
    primarykey
    data
    text
    <p>How can I set the width of the text-box when the field is editing?</p> <pre><code>EditTextCell febCell = new EditTextCell(); Column&lt;DTO, String&gt; febColumn = new Column&lt;DTO, String&gt;(febCell){ @Override public String getValue(DTO object) { return (String.valueOf(object.getFeb())); } }; febColumn.setFieldUpdater(new FieldUpdater&lt;DTO, String&gt;() { public void update(int index, DTO object, String value) { System.out.println("index="+index+" resourceId="+object.getId()+" feb="+value); } }); febColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LOCALE_END); cellTable.addColumn(febColumn, "Feb"); cellTable.setColumnWidth(febColumn, 3, Unit.PCT); </code></pre> <p>Everything is working well, but when I do click on the editable field a very big text box appears. So, how can I customize this widget for editing the data?</p> <p>If I do set the width in PX instead of PCT like</p> <pre><code>cellTable.setColumnWidth(febColumn, 25, Unit.PX); </code></pre> <p>the cell does not explode while editing, but the inner text box still has the same long width and a long string value hides out behind the right side.</p> <p>OK. Probably I need reinvent to the wheel for each kind of EditTextCell like that:</p> <pre><code>MyEditTextCell extends AbstractEditableCell&lt;String, MyEditTextCell.ViewData&gt; ... interface MyTemplate extends SafeHtmlTemplates { @Template("&lt;input type=\"text\" value=\"{0}\" tabindex=\"-1\" size=\"{1}\" maxlength=\"{1}\" style=\"{2}\"&gt;&lt;/input&gt;") SafeHtml input(String value, Integer maxLength, String style); } ... @Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {... sb.append(template.input(text, maxLegth, style)); </code></pre> <p>And use the widget like that:</p> <pre><code>MyEditTextCell febCell = new MyEditTextCell(SimpleSafeHtmlRenderer.getInstance(), 4, "width:35px;"); </code></pre> <p>Any ideas are welcome.</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.
 

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