I have a listview consisting of user info in a HTML table that I want to
refresh when the user picks a value from a dropdownlist of department codes.
Below is the pseudocode, cobbled together from various postings on the net.
The code runs the first time; however, subsequent requests do not refresh
the listview.
What am I doing wrong? Appreciate any help.
Java code:
Form f = new Form("bgForm", new CompoundPropertyModel(this));
List <String> depts = new ArrayList<String> ();
depts.add("A");
depts.add("B");
depts.add("C");
model = new Model();
DropDownChoice dd = new DropDownChoice("bgIds", model, depts);
sectionDropDown.setRequired(true);
f.add(dd);
f.add(new AjaxButton("submitBG", f)
{
protected void onSubmit(AjaxRequestTarget target, Form
form)
{
userlist = (ArrayList) DB.getUsers("B");
target.addComponent(bgUsers);
});
add(f);
users = new WebMarkupContainer("bgUsers");
users.setOutputMarkupId(true);
users.setOutputMarkupPlaceholderTag(true);
add(users);
userlist = (ArrayList) DB.getUsers("A");
ListView userEntries = new ListView("userEntries", userlist)
{
protected void populateItem(ListItem item)
{
item.setModel(new
CompoundPropertyModel(item.getModelObject()));
item.add(new Label("last"));
item.add(new Label("first"));
item.add(new Label("email"));
item.add(new Label("status"));
}
};
users.add(userEntries);
HTML:
<form wicket:id="bgForm" id="bgsub" name="bgsub" method="post"
action="">
<div>
<label for="busgroups" class="label" id="bglabel">Users
for Business
Group</label>
<select wicket:id="bgIds" name="busgroups"
id="busgroups">
<option value="1">A</option>
<option value="2">B</option>
</select>
<input wicket:id="submitBG" type="submit" value="GO">
</div>
</form>
<div wicket:id="bgUsers">
<div id="bgusers">
<table summary="List of users for the selected
business group">
<tr>
<th scope="col">Last Name</th>
<th scope="col">First Name</th>
<th scope="col">Email</th>
<th scope="col">Status</th>
</tr>
<tr wicket:id="userEntries">
<td wicket:id="last">Allen </td>
<td wicket:id="first">Stephen</td>
<td wicket:id="email">[EMAIL
PROTECTED]</td>
<td wicket:id="status">Active</td>
</tr>
</table>
</div>
</div>
--
View this message in context:
http://www.nabble.com/Refreshing-a-listview-using-AJAX-tp18720967p18720967.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]