Disable request data query in power table

Good morning at all,
I have aquestion about possibility to disable request data to DB from power table.

I try to explein better:
In my page I have 2 powertable that read data from different tables.
With a button i go to enable/disable visibility (or enable property) of them, but I have see that in every case they go to read data to database.
For reduce traffic I want to use visibility as key for enable the polling.

Somebody have an idea if this is possible?

Thanks

Turn polling off in the table’s data binding. Use a timer component set to your desired poll rate, and bind its enable property to the visibility of the table. In the timer’s actionPerformed event, use system.db.refresh to tell the table’s query binding to run.

I have try to do this, but data don’t refresh.

I have try to do this putting on a button script:

from java.lang import Exception as JException

try:

event.source.parent.getComponent('Range').getComponent('ptProdRange').data = None
system.db.refresh(event.source.parent.getComponent('Range').getComponent('ptProdRange'), "data")

except JException, e:
print e.cause

in data i see data go down and come back with old data.

Binding is a SQL Query

During my test on this problem I have detect this “strange” functionality…

My data binding is a SQL QUery with Where parameter depending of object in same window.

Databing is off, but if parameter change, binding is refreshed without nothing that do request…

Yes, bindings refresh automatically if anything they depend on change. If you don’t want that to happen, you’ll need to do the entire query operation in a background script, not a binding, started only when you desire. Bindings set to “no poll” are also run at least once when the window opens. You haven’t set the binding to OFF, just the poll.

When parameter for binding change and pool is OFF, at which rate data will be automatically refreshed?

Thanks

And another question , when I go to use this in script system.db.refresh(table,‘property’) how can be sure that refresh is completed?

Thanks

No rate. It will be refreshed once per reference change. If two references change very close together in time, the refreshes they trigger may be coalesced into a single refresh.

Use a propertyChange event checking the bound property name–that will fire when the completed data is delivered.

If I test like this in script is not good?

if system.db.refresh(table,‘data’) :
logger.info(“New data : refresh data DONE” )

No. Refresh of asynchronous bindings is asynchronous.