Anyone know how to solve this?
Thanks.
steviezz wrote:
>
> Wicket 1.3.4.
>
> I have a Page (ThingListing) containing an AjaxFallbackDefaultDataTable -
> created like:
>
> private WebMarkupContainer listContainer = new
> WebMarkupContainer("listContainer");
> private MySortableDealProvider dataProvider;
> private Thing thing = null;
>
> public ThingListing(PageParameters params) {
>
> // this is a reload from the CRUD page
>if (params != null) {
>
> setThing(getThingManager().findById(params.getString("thingId")));
>}
> // else load everything
>
> ...
>
> dataProvider = new SortableDealDataProvider(getThingManager(), thing);
>
> String sort = params.getString("sort");
> Boolean isAscending = params.getBoolean("ascending");
> dataProvider.setSort(sort, isAscending);
>
> ...
>
> listContainer.add(new AjaxFallbackDefaultDataTable("mything", columns,
> dataProvider, TABLE_ROWS));
>
>
> I add an AbstractColumn to the AjaxFallbackDefaultDataTable to handle
> forwarding to a page to do CRUD work on the selected item from the table -
> like :
>
>columns.add(new AbstractColumn(new Model("Edit")) {
>
> public void populateItem(Item cellItem, String
> componentId, IModel
> model) {
> cellItem.add(new ActionPanel(componentId,
> model));
> }
>
> public String getCssClass() {
> return "edit";
> }
> });
>
>
>
> class ActionPanel extends Panel {
>
> public ActionPanel(String id, IModel model) {
> super(id, model);
> add(new Link("edit") {
>
> public void onClick() {
> Integer thingId = ((Thing)
> getParent().getModelObject()).getId();
> PageParameters params = new
> PageParameters();
> params.put("thingId", thingId);
> params.put("sort",
> dataProvider.getSort().getProperty());
> params.put("ascending",
> dataProvider.getSort().isAscending());
> setResponsePage(ThingEdit.class,
> params);
> }
> });
> }
> }
>
>
> Note - I am attempting to pass the id of the selected row in the table,
> plus the sort column, and the ascending direction to the CRUD page.
>
> The ThingEdit CRUD page takes all the page params from the ThingListing
> page, does normal CRUD work, then passes back all the params back into the
> main listing page constructor so that when the listing page reloads, it
> maintains its state (main selection criteria, sort column, sort order)
> from the page the user selected before triggering the CRUD page - eg:
>
> public class ThingEdit {
>
> private PageParameters pageParams;
>
> public ThingEdit(PageParameters p) {
> pageParams = p;
>
> ...
> }
>
>...
>
>private void addCancelButton(Form form) {
>Button cancel = new Button("cancelbutton") {
> public void onSubmit() {
> setResponsePage(ThingListing.class, pageParams);
>}
> };
>
> cancel.setDefaultFormProcessing(false);
> form.add(cancel);
> }
>
>
> However, I can't work out how to go back to the page number that the user
> was on before he loaded the CRUD page. That is, if the user was on page 3
> of 20, then after clicking a record to edit goes to the CRUD page, then he
> goes back to the listing the correct order and sort are maintaine, but
> he's always at page 1 of 20 instead of page 3.
>
> I have tried manually setting the ThingSortableDataProvider.iterator()
> first and count and with additional page params - but this just ends up
> with it being called twice - once with my page params, and again by the
> default 0 and count.
>
> So, any way to make this work?
>
> I think am probably still missing the point with Wicket (can't really get
> my head around Models) and revert to attempting to use page params and
> manually adding to session to pass data from one page to another and back
> again.
>
>
> Steve
>
--
View this message in context:
http://www.nabble.com/AjaxFallbackDefaultDataTable---goto-page-number-on-return-from-another-page-tp18744983p19247459.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]