you cannot update a listview with ajax, i think its in the faq. wrap it in a
webmarkupcontainer and update that instead.
-igor
On 4/8/07, Robbert Vergeten <[EMAIL PROTECTED]> wrote:
Hi, i'm new to wicket and currently trying out some things to learn wicket
and to do proof-of-concepts with ajax functionality.
Because for what I want for my actual application i'm going to need a lot
of Ajax.
I'm having a problem with an ajax update of a list through ajax. The
concept is a simple variation of the databinder.net example.
Its like a guestbook/chat example with a form for input and a list for the
output. With both the ajax and the normal submit
the server sends and receives the proper data only with the ajax the list
is not properly updated because it works with id's.
And all items in my list have the same id and therefore only the first
gets updated so to speak.
(IE and FF give quite different (both wrong) results.)
I'm quite stuck on this so my question is how should i properly pack the
output list into a single object with custom behavior
that can handle its own update as a single component. Like a table instead
of a list of rows.
Any hints or links on where to start are most welcome.
my current code:
list = new PropertyListView("list", new HibernateListModel(ChatLine.class,
new ICriteriaBuilder(){
public void build(Criteria criteria){
criteria.addOrder(Order.desc ("id"));
criteria.setMaxResults(10);
}})){
@Override
protected void populateItem(ListItem item) {
Label textLine = new Label("text");
Label userName = new Label("username");
item.add(userName);
item.add(textLine);
}};
list.setOutputMarkupId(true);
add(list);
form = new DataForm("chatform", ChatLine.class){
@Override
protected void onSubmit() {
super.onSubmit();
clearPersistentObject();
}};
form.add (new TextField("text"));
form.add(new TextField("username"));
form.add(new AjaxSubmitButton("ajaxsubmit", form){
@Override
protected void onSubmit(AjaxRequestTarget target, Form f) {
target.addComponent(list);
}});
add(form);
<wicket:extend>
<div style="margin-top:20px; position:absolute;">
<table class="chatline">
<tr wicket:id="list" id="list">
<td wicket:id="username" class="user"></td>
<td>: </td>
<td wicket:id="text" class="text"></td>
</tr>
</table>
</div>
<div style="margin-top:700px; position:absolute;">
<form wicket:id="chatform">
<table>
<tr>
<td>Username:</td>
<td>Chat Message:</td>
</tr>
<tr>
<td><input type="text" wicket:id="username" /></td>
<td><input type="text" wicket:id="text"/ size="80"></td>
</tr>
</table>
<div style="margin-left:100px; position:absolute;">
<input type="submit" wicket:id="ajaxsubmit" value="send">
<input type="submit" value="send">
</div>
</form>
</div>
</wicket:extend>
Thanks in advance,
Robbert
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user