tags:

views:

359

answers:

2

I've got datatable, which is pulling information from a database. I've added a button to the form that I want to use to force the table (id of "table") to refresh, however I'm not sure how to do it. What I have now is:

<h:commandButton value="Refresh">
    <f:ajax render="table"/>
</h:commandButton>

My goal was to have the table component be forced to render when the button is clicked. However, it appears that either the click is being ignored, or it's returning cached data, rather than actually going out and calling my database code again.

What am I doing wrong?

+1  A: 

You have to specify an action in your commandButton which calls a bean and refreshes the data displayed in the table (currently the button does nothing). I'm not a Pro, but i think it should look like this:

<h:commandButton value="Refresh" action="#{myBean.refreshData}">
  <f:ajax render="table"/>
</h:commandButton>
ifischer
I've tried that too. The bean method does get called, but the table never updates. There's no special need for a method to be called in my case because the getter that the table references does the database lookup (I'm not caching in an object currently).
Brian Knoblauch
A: 

Ugh. It's actually working, just incredibly painfully slow. We switched database servers recently, and a query that took less than a second on the old one just happens to take 20+ seconds on the new one. I was just timing out while watching it. Sigh.

As a side note, as soon as I figured that out, I tested both with and without an action. Works both ways (with the getter doing the lookup).

Brian Knoblauch