Question

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.

Was it helpful?

Solution

There are one or two things that you can do about this.

First please check whether the data provider has the latest data.

Secondly make sure that the set of records with the Data provider is refreshed when the browser back button is hit. Ensure that the data fed to the Data Provider is refreshed in a method other than constructor. Because constructors will not be called when you hit back. So you would need to use a separate method. Ideally you could use the same method, but called from both constructor and when back button is pressed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top