You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jayakrishnan R <jk...@gmail.com> on 2013/03/25 16:50:53 UTC

Wicket DefaultDataTable - Refresh it on browser back button

Hi All,

In my application I am using *DefaultDataTable *with
*SortableDataProvider *which
has *LoadableDetachableModel *as the model.

I used it to display a set of records ( say RecordList page). When I add or
remove some records and load the page RecordList again, it displays the
changes. However, if I use the back button of the browser and go the
RecordList page which was rentered earlier ( before adding/ removing the
records ). The *DefaultDataTable *still has the old sets of records. This
is a big issue when records are deleted.

For example, If I delete a record and press back button then the page fails
as the record it is trying to show does not exist in the database. Adding
does not create an issue because it simply does not get listed in the set
of records.

In another page, I just have *PageableListView *with *
LoadableDetachableModel*. It works fine with out an issue.

Can someone advice me on how to refresh the data table on browser back
button ?

-- 
Thanks & Regards
JK

Re: Wicket DefaultDataTable - Refresh it on browser back button

Posted by Jayakrishnan R <jk...@gmail.com>.
Hi Martin,

Thanks for the direction. I finally found the problem. The list of records
( collection ) was assigned to the data provider in the contructor of that
page. So when I press back button, the latest data was not getting
refreshed.

I still need to find a way to push the latest data on to the model.

Thanks
JK


On Mon, Mar 25, 2013 at 4:08 PM, Jayakrishnan R <jk...@gmail.com> wrote:

>
> Hi,
>
> Does that mean that the DataProvider returns primary key objects which are
> used in the LoadableDetachableModel to load the real object ?
>
> I am not sure. But one thing I noticed, the load() method of the
> LoadableDetachableModel is not being called when the back button is hit.
>
> I am getting exception the populateItem method .of the columns in the data
> table... see below.
>
>
>     List<IColumn<Record>> columns = new ArrayList<IColumn<Record>>();
>
>    columns.add(new AbstractColumn<Record>(
>                 new StringResourceModel("Record_number", this, null),
>                 "Record_number") {
>
>             @Override
>             public void populateItem(Item item, String id, IModel
> rowModel) {
> }};
>
>
>
>
>
> On Mon, Mar 25, 2013 at 3:55 PM, Martin Grigorov <mg...@apache.org>wrote:
>
>> Hi,
>>
>> On Mon, Mar 25, 2013 at 5:50 PM, Jayakrishnan R <jk...@gmail.com>
>> wrote:
>>
>> > Hi All,
>> >
>> > In my application I am using *DefaultDataTable *with
>> > *SortableDataProvider *which
>> > has *LoadableDetachableModel *as the model.
>> >
>>
>> Does that mean that the DataProvider returns primary key objects which are
>> used in the LoadableDetachableModel to load the real object ?
>>
>> Check why your DataProvider returns (the ids of) deleted objects when back
>> button is used.
>>
>>
>> >
>> > I used it to display a set of records ( say RecordList page). When I
>> add or
>> > remove some records and load the page RecordList again, it displays the
>> > changes. However, if I use the back button of the browser and go the
>> > RecordList page which was rentered earlier ( before adding/ removing the
>> > records ). The *DefaultDataTable *still has the old sets of records.
>> This
>> > is a big issue when records are deleted.
>> >
>> > For example, If I delete a record and press back button then the page
>> fails
>> > as the record it is trying to show does not exist in the database.
>> Adding
>> > does not create an issue because it simply does not get listed in the
>> set
>> > of records.
>> >
>> > In another page, I just have *PageableListView *with *
>> > LoadableDetachableModel*. It works fine with out an issue.
>> >
>> > Can someone advice me on how to refresh the data table on browser back
>> > button ?
>> >
>> > --
>> > Thanks & Regards
>> > JK
>> >
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com <http://jweekend.com/>
>>
>
>
>
> --
> Thanks & Regards
> JK
>



-- 
Thanks & Regards
JK

Re: Wicket DefaultDataTable - Refresh it on browser back button

Posted by Jayakrishnan R <jk...@gmail.com>.
Hi,
Does that mean that the DataProvider returns primary key objects which are
used in the LoadableDetachableModel to load the real object ?

I am not sure. But one thing I noticed, the load() method of the
LoadableDetachableModel is not being called when the back button is hit.

I am getting exception the populateItem method .of the columns in the data
table... see below.


    List<IColumn<Record>> columns = new ArrayList<IColumn<Record>>();

   columns.add(new AbstractColumn<Record>(
                new StringResourceModel("Record_number", this, null),
                "Record_number") {

            @Override
            public void populateItem(Item item, String id, IModel rowModel)
{
}};





On Mon, Mar 25, 2013 at 3:55 PM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
> On Mon, Mar 25, 2013 at 5:50 PM, Jayakrishnan R <jk...@gmail.com> wrote:
>
> > Hi All,
> >
> > In my application I am using *DefaultDataTable *with
> > *SortableDataProvider *which
> > has *LoadableDetachableModel *as the model.
> >
>
> Does that mean that the DataProvider returns primary key objects which are
> used in the LoadableDetachableModel to load the real object ?
>
> Check why your DataProvider returns (the ids of) deleted objects when back
> button is used.
>
>
> >
> > I used it to display a set of records ( say RecordList page). When I add
> or
> > remove some records and load the page RecordList again, it displays the
> > changes. However, if I use the back button of the browser and go the
> > RecordList page which was rentered earlier ( before adding/ removing the
> > records ). The *DefaultDataTable *still has the old sets of records. This
> > is a big issue when records are deleted.
> >
> > For example, If I delete a record and press back button then the page
> fails
> > as the record it is trying to show does not exist in the database. Adding
> > does not create an issue because it simply does not get listed in the set
> > of records.
> >
> > In another page, I just have *PageableListView *with *
> > LoadableDetachableModel*. It works fine with out an issue.
> >
> > Can someone advice me on how to refresh the data table on browser back
> > button ?
> >
> > --
> > Thanks & Regards
> > JK
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>



-- 
Thanks & Regards
JK

Re: Wicket DefaultDataTable - Refresh it on browser back button

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Mar 25, 2013 at 5:50 PM, Jayakrishnan R <jk...@gmail.com> wrote:

> Hi All,
>
> In my application I am using *DefaultDataTable *with
> *SortableDataProvider *which
> has *LoadableDetachableModel *as the model.
>

Does that mean that the DataProvider returns primary key objects which are
used in the LoadableDetachableModel to load the real object ?

Check why your DataProvider returns (the ids of) deleted objects when back
button is used.


>
> I used it to display a set of records ( say RecordList page). When I add or
> remove some records and load the page RecordList again, it displays the
> changes. However, if I use the back button of the browser and go the
> RecordList page which was rentered earlier ( before adding/ removing the
> records ). The *DefaultDataTable *still has the old sets of records. This
> is a big issue when records are deleted.
>
> For example, If I delete a record and press back button then the page fails
> as the record it is trying to show does not exist in the database. Adding
> does not create an issue because it simply does not get listed in the set
> of records.
>
> In another page, I just have *PageableListView *with *
> LoadableDetachableModel*. It works fine with out an issue.
>
> Can someone advice me on how to refresh the data table on browser back
> button ?
>
> --
> Thanks & Regards
> JK
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>