Hi,
I'm developing an application in which I'm using the TreeTable component.
My table contains the "table" (nodes) and 7 other columns which are
TextField's in
which users may enter data. OnBlur on the TextFields updates the model:
public EditablePanel(MarkupContainer parent, String id, final IModel
inputModel, final TreeTable treeTable, final TreeNode treeNode)
{
super(id);
setOutputMarkupId(true);
final TextField field = new TextField("textfield", inputModel);
field.setOutputMarkupId(true);
field.add(new AttributeAppender("size", new Model("2"), ""));
add(field);
field.add(new AjaxFormComponentUpdatingBehavior("onblur")
{
protected void onUpdate(AjaxRequestTarget target)
{
((DefaultTreeModel)treeTable.getModelObject()).nodeChanged(treeNode);
treeTable.updateTree(target);
target.focusComponent(field);
}
});
}
Since I update the components in the Ajax response, I thought I could set
the focus
on the component (input) I just updated, but it seems the Ajax response has
given
the components new markupId's and hence, the line:
target.focusComponent(field)
Is pretty much useless as the id's in the HTML has been altered (by Ajax
response),
and the input with the old id is no longer on the page.
I dont quite know how to get the new markupId's, anyone?
Cheers, Lars Borup Jensen
--
Lars Borup Jensen
http://www.it-arbejde.dk