try target.focusComponent(listview.get(listview.size()-1).get("name")) ;


On Sat, Sep 21, 2013 at 1:21 AM, Anatoly Kupriyanov <[email protected]>wrote:

> A have a list model
>
> IModel<List<Something>> model;
>
> the list is displayed as a simple grid table PropertyListView, each
> line is a set of controls to edit Something.
>
>             @Override
>             public void populateItem(final ListItem<Something> listItem)
>             {
>                  listItem.add(new TextField("name"));
>                  listItem.add(new TextField("value"));
>                 ....
>             }
>
> There is an a "addNew" ajax button below the table which adds a new
> element in the model's list:
>
>             public void onClick(final AjaxRequestTarget target) {
>                 final List<Something> list = model.getObject();
>                 list.add(new Something());
>                 target.add(listViewContainer);// repaint the list view
>                 target.focusComponent(??????????); // Focus "name"
> textbox.
>             }
>
> After the button click I want to set focus to the one of controls in
> the new line appeared. How to do it?
>
> Wicket 6.10.0
>
> --
> WBR, Anatoly.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
regards,

Vineet Semwal

Reply via email to