Вопрос

I have a link with two option edit & delete. When some one click on the link a text box appears in that text box the content of the link will be appear but i need the cursor position at the end of the text without using mouse with the help of tab index only.

final TextBox editTb = new TextBox();
editTb.addStyleName(EDIT_FAV_DELETE_STYLE);
editTb.setText(favoriteBean.getName());

Scheduler.get().scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
 editFavoriteTb.setFocus(true);
}
    });

Already using setFocus(true) but this showing the cursor position at the start of the text i need it at the last.

Это было полезно?

Решение

Check this

    final TextBox editTb = new TextBox();
    editTb.addStyleName(EDIT_FAV_DELETE_STYLE);
    editTb.setText(favoriteBean.getName());

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

    @Override
    public void execute() {
     editFavoriteTb.setFocus(true);
     editTb.setCursorPos( favoriteBean.getName().length());
    }
  });
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top