Well, if I understood it right, then its quite easy:
you have a "personalList" where you add(Component c) to - you can replace
that by
addOrReplace(Component c) and if there is a Component with Tag "foo" there
then it will be replaced, else it will be put to it.
You can also use .remove(Component C) or .remove(String id) to remove a
component whose given IDs match - so, the .remove would be the answer to
your question.
Be sure to checkout the examples at:
http://wicketstuff.org/wicket13/
and especially:
http://wicketstuff.org/wicket13/repeater/
and how AJAX should work, as your AJAX code looks quite odd to me
http://wicketstuff.org/wicket13/ajax/
(to use AJAX you need to manipulate the markupcontaier wich doesnt work with
a repeater like ListView or RepeatingView unless you span a
WebMarkupContainer around it - explained in wiki:
http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html )
However, i suggest you to get it working with a usual Link first, and then
try to AJAXify it,
Regards
_____
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Felipe
Piccolini
Gesendet: Mittwoch, 23. Mai 2007 22:13
An: [email protected]
Betreff: [Wicket-user] How to auto-eliminate component from RepeatingView
Hi, I'm new to wicket and I'm trying to do a sort of nested list of
components, but each
list's item (component) has not just info about the model, but also has
links to delete/modify
itself from the list...
so I have this html code...
Group.html:
<div>
<dl wicket:id="personalList"">
</dl>
</div>
and Person.html:
<dt> <sub>-.</sub> </dt>
<dd><a wicket:id="delPerson" href="#"><img wicket:id="btn_del"
src="res/btn_del.jpg"/></a></dd>
<dd><a wicket:id="modPerson" href="#"><img wicket:id="btn_mod"
src="res/btn_mod.jpg"/></a></dd>
<dd><label wicket:id="idPerson">01</label></dd>
So the Group.java gets the PersonModel and adds a new Person component to
the RepeatingView...
RepeatingView personalList = new RepeatingView("personalList");
for (Iterator iter = personalModelList.iterator(); iter.hasNext();)
{
PersonModel personModel = (PersonModel) iter.next();
final Person oPerson = new Person("person", personModel);
personalList.add(oPerson);
}
add(personalList);
My question is this:
How can I do to make the "delete this person" works in order to get it
removed from the RepeatingView?
I was trying this code inside the Person.java so the component (item from
the list) can activate the auto-remove
from the list, but doesn't work:
final AjaxLink delPersonaRel = new AjaxLink("delPersonLink"){
public void onClick(final AjaxRequestTarget target)
{
getParent().remove(this);
System.out.println("person deleted");
target.addComponent(getParent());
}
};
Any suggestion appreciated.
Felipe Piccolini M.
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user