Async Table - Beyond End Of Data?

I’m using an async table to display query results in a portlet. It’s set to display 10 rows with the ability to navigate to the next/prev page when there are more rows returned. My problem comes in when I run a query that returns >10 rows and I then navigate to the next page, then run a new query which returns <10 rows. I get a message “Beyond End Of Data” and have to click on “previous” in order to view the results.

Is there any way to reset the table to the first page when I run the query?

Thanks :slight_smile:

hi
do you refresh the table after running the query?

regards,
Javier

I think so… the table is “linked” to a web service call, and clicking the Query button executes the Refresh() of the web service. Does this refresh the table automatically? Or do I have to do it manually in code?

well, if you use an Async Command Button to call the WSC and leave its refresh property empty (which should refresh the whole view), that should refresh the table as well…
what happens if you explicitly set the refresh of your button to refresh the table?
regards
Javier

Tried the refresh property (of the async command button) as empty and specified to the table and although it does seem like it’s refreshing, it’s not going back to the first page, it stays on the page saying “Beyond End Of Data”

You can adjust the table’s paging state in your action by getting a
reference to the table component (you can create a getter for this on
your page bean by right-clicking the control in the view editor and
selecting Source > Create Control Accessor) and setting
the table component’s “first” property to the index of the first row to
display, and/or its “rows” property to the number of rows to display.
Alternately, if you have those properties bound to a property on some
bean (like your page bean), you can just adjust those properties on that
bean.

With the jsf table’s design the paging of the ui is independent of
the data model. The ui (the table control) doesn’t necessarily know
when the data model changes, or whether it’s been changed by a ui add
operation or by some remote change to the back-end data store. That’s
why you have to manually adjust the table control’s paging state.

Add the following piece of code in a Script Block towards the end of your view by giving the ID of your Async Table Control appropriately.


var windowLoaded = window.onload;
if(windowLoaded)
{
	CAF.model("#{activePageBean.clientIds['asyncTableId']}").go(0,-1,null);
}

Hope this helps,
Best regards,
Raj

Thanks for this, it’s working now :slight_smile: