we are using in our project an Async Table with a Data Prev/Next component in the table’s footer for paging.
The table is used for storing the results of a search in a popup window. Unfortunately it has odd behavior:
following the next scenario:
- Introduce the filter value in the input text, press search button
- Results are displayed on multiple pages (for ex 5)
- Go to page 3
- Make another search with another search criteria that returns multiple results
- One would expect the selected page to be page 1, but the actual result is that page 3 (the one selected in the first search) is selected
In cases when the second search has less result pages than the initial one, an empty page is displayed and the “Back” navigation link of the Data Prev/Next component remains active, allowing to move back to the wished page. For example in a situation when the first search returns 10 results pages and the 5 page was selected and the second search returns only one page , one has to move back through 4 empty until finds the results.
No special settings are made either for the table or for Data Prev/Next.
I would appreciate any suggestion/ experience on the topic.
Thank you for your time and ideas.
Best regards and wishes,
The row number (zero-relative) of the first row to be displayed in the table is controlled by the value of the ‘First’ property of the table control.
So whenever you do a new query that changes the data in the table content provider (step #4 in your scenario) you would want to reset that value back to zero.
The simplest way to do that is to add an integer field to your page bean that holds the value of the first row to show and then bind the ‘First’ property of the Table control to that field. Then you can just change the value of the field back to zero whenever you do a new query and the table paging would move back to the first position.
thanks for your reply. I tried to use your suggestion, but unfortunately it doesn’t work. So I did the following:
- added an integer property “first” in the code
- I bound the first property of the async table to the given property
- after I do the search, I set the first property to 0
- at the second search, the results are displayed and the page is set to 1 (as wanted)
- after 1 second the table refreshes/reloads and the page is set up to the value that was set before the second search (e.g. 2)
I my feeling the state of the table is somehow stored also on the client side or the table refreshes when the async table finished the call. To be honest I pretty much run out of ideas.
Thanks for your, if you have other suggestions please don’t hesitate :). Thanks in advance.