Hi, thanks for your reply. As I said, the troublesome component seems to be a container which is composed of the following:
ListView author = new
CompoundListView("author")
{
private static final long
serialVersionUID = 1L;
@Override
protected void populateItem(final
ListItem item)
{
item.add(new Label("name"));
// Ajax link to delete the
current row
AjaxSubmitLink deleteRow = new
AjaxSubmitLink("deleteRow")
{
private static final
long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
@Override
protected void
onSubmit(AjaxRequestTarget target, Form form)
{
ProjectProduct
projectProduct = (ProjectProduct)
this.getModelObject();
projectProduct.getAuthor().remove(item.getIndex());
target.addComponent(authorContainer);
}
};
item.add(deleteRow);
}
};
authorContainer.add(author);
final AutoCompleteTextField personName = new
AutoCompleteTextField("personName", new Model())
{
private static final long
serialVersionUID = 1L;
@SuppressWarnings("unchecked")
@Override
protected Iterator getChoices(String
input)
{
List<String> results = new
ArrayList<String>();
if (input.length() <
MINAUTCOMPLETEINPUTLENGHT) {
results.add(getLocalizer().getString("search.parameter.too.short",
this));
}
else {
Criteria criteria = new
Criteria();
criteria.addFilter("lastName", CriteriaOperators.BEGINSWITH, input);
for(PersonInfo p :
uService.getPersonInfoByCriteria(criteria,
defaultPaginator)) {
//only filter
professors
results.add(p.getName() + " - " + "D.N.I.:" + p.getDni());
}
}
if(results.size() ==
MAXAUTOCOMPLETEROWS) {
results.add(getLocalizer().getString("too.many.results", this));
}
return results.iterator();
}
};
authorContainer.add(personName);
// Ajax link to add a row
AjaxSubmitLink addAuthor = new
AjaxSubmitLink("addAuthor")
{
private static final long
serialVersionUID = 1L;
@Override
protected void
onSubmit(AjaxRequestTarget target,
Form form)
{
ProjectProduct projectProduct =
(ProjectProduct)
form.getModelObject();
String name =
(String)personName.getConvertedInput();
if(name == null)
{
//Error
}
else
{
String dni =
EditProjectForm.extractDniFromUserString(name);
PersonInfo aPerson =
uService.getPersonInfobyDNI(dni);
if(!projectProduct.getAuthor().contains(aPerson) && aPerson != null)
{
projectProduct.addAuthor(aPerson);
//target.addComponent(authorContainer);
}
else if(aPerson == null)
{
//Error por
inexistente
}
else
{
//Error por
repetido
}
}
target.addComponent(authorContainer);
}
};
authorContainer.add(addAuthor);
This is in turn inside a class extending Form, and the container is declared
as follows:
final WebMarkupContainer authorContainer = new
WebMarkupContainer("authorContainer");
authorContainer.setOutputMarkupId(true);
add(authorContainer);
I'd like to stress that this same code is working elsewhere, though there's
no lonely textfields beneath in that form, but there are other similar
containers.
Author is a lisview displaying all authors, the autocompletetextfield is
used to input a new author, and the button is supposed to add the author to
the list.
Thanks,
Ezequiel
Timo Rantalaiho wrote:
>
>
> If you can provide a quickstart containing only the few
> necessary parts, others can try checking it it's a bug or
> if you can fix something in your code.
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oy <URL: http://www.ri.fi/ >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Ajax-link-doesn%27t-call-event-tp18219220p18237350.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
