You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "LEWIS, LONNIE" <lo...@hp.com> on 2009/07/27 20:55:56 UTC
Problem with PagingNavigator and NavigatorLabel
Hello,
I am a newbie to Wicket and am trying to fix an existing page. My problem: we have a simple page containing a PagingNavigator and NavigatorLabel. They both display the correct data upon initial load. To add a record, we navigate to a page, enter the data and press "submit". The data is saved correctly (using JPA's "save" method) and we navigate back to the initial page using "setResponsePage". This is when I have a problem, the "NavigatorLabel" isn't updated at all, it still read "Showing 1 to 3 of 3" (if we originally had three records, now have four). Also, the data in the "PagingNavigator" isn't updated correctly. The size of the control isn't adjusted to include the new record. The new record may appear, if the sort order causes it to appear in the middle of the resut set.
What are we doing wrong?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with PagingNavigator and NavigatorLabel
Posted by Igor Vaynberg <ig...@gmail.com>.
sounds like you are not using loadable detachable models in your listview
-igor
On Mon, Jul 27, 2009 at 11:55 AM, LEWIS, LONNIE<lo...@hp.com> wrote:
> Hello,
> I am a newbie to Wicket and am trying to fix an existing page. My problem: we have a simple page containing a PagingNavigator and NavigatorLabel. They both display the correct data upon initial load. To add a record, we navigate to a page, enter the data and press "submit". The data is saved correctly (using JPA's "save" method) and we navigate back to the initial page using "setResponsePage". This is when I have a problem, the "NavigatorLabel" isn't updated at all, it still read "Showing 1 to 3 of 3" (if we originally had three records, now have four). Also, the data in the "PagingNavigator" isn't updated correctly. The size of the control isn't adjusted to include the new record. The new record may appear, if the sort order causes it to appear in the middle of the resut set.
>
> What are we doing wrong?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with PagingNavigator and NavigatorLabel
Posted by Lonnie Lewis <lo...@hp.com>.
Not sure what code to include. The authors used a lot of class inheritance,
so it is difficult to include the whole thing.
HTML
<table cellspacing="0" class="dataTableView">
<tr>
<th class="navigatorLabel" colspan="1" wicket:id="navigatorLabel">Showing
1 to 25 of 1157</th>
<th class="navigator" colspan="2" wicket:id="navigator"><< < 1 2
3 4 5 6 7 8 9 10 > >></th>
</tr>
<tr class="headers">
<th wicket:id="orderByEmailAddress">Email Address</th>
<th>Delete?</th>
<th>Edit</th>
</tr>
<tr wicket:id="sorting">
<td wicket:id="emailAddress">[emailAddress]</td>
<td><input type="checkbox" wicket:id="marked" /> </td>
<td><input type="submit" wicket:id="editButton" value="Edit" /></td>
</tr>
</table>
Some of the code
Creates the data view
protected DataView createDataView () {
DataView view = new DataView("sorting", getDataProvider()){
@SuppressWarnings("unchecked")
protected void populateItem (final Item item) {
MarkablePersistableWrapper wrapper =
(MarkablePersistableWrapper)item.getModelObject();
addRowItems(item, wrapper, (T)wrapper.getTarget());
addEditingRowFields(item, wrapper);
item.add(new AttributeModifier("class", true, new
AbstractReadOnlyModel(){
public Object getObject () {
return (item.getIndex() % 2 == 1) ? "even" : "odd";
}
}));
}
};
view.setItemsPerPage(getAdminService().getConsoleConstants().getNoOfRows());
return view;
}
Save the row and return
protected void commitForm () {
if (validateItem()) {
try {
//Saves the new record
getPersistableManager().save(getPersistable());
//Return to summary page
setResponsePage(getFormResponsePage());
}
catch (RuntimeException e) {
throw e;
}
}
}
Is this what you are looking for?
Thanks for the help!
Mathias Nilsson wrote:
>
> Can you provide us with some code on which model you use and how?
>
--
View this message in context: http://www.nabble.com/Problem-with-PagingNavigator-and-NavigatorLabel-tp24694245p24698057.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with PagingNavigator and NavigatorLabel
Posted by Mathias Nilsson <wi...@gmail.com>.
Can you provide us with some code on which model you use and how?
--
View this message in context: http://www.nabble.com/Problem-with-PagingNavigator-and-NavigatorLabel-tp24694245p24697018.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org