Need help using a refresh button to reset table to first row

I have a portlet with an IS service that shows a query result as an Async table. The table has the DataNextPrev and DataTotal objects added to the footer. When the IS service was generated, an Async Command button called “Refresh” was included. Unfortunately, this button does nothing but repaint the screen. I want a “Refresh” button that will re-display the Async table, beginning with the 1st row - in other words, reset the DataNextPrev object to point to the beginning; or close the table, clear the DataNextPrev object, and reset other values (like a dropdown list box) to their initial state.
So, does anyone have experience with a “refresh” function? and/or with programming the DataNextPrev object?

Hi
The mentioned “Refresh” makes a call to the IS service to retrieve whatever results the service delivers.
If instead of refreshing the table contents you want to “go back” to displaying the first row, you could use the following javascript (supposing ‘asyncTable’ is your table’s id):

CAF.model('#{caf:cid('asyncTable')}').go(0,-1,null);

If you were using v7.x instead of v8, you would need a different method to get the table’s client side id. It would look like:

CAF.model('#{activePageBean.clientIds['asyncTable']}').go(0,-1,null);

Hope this helps,
Javier

1 Like

Thanks, Javier! I am running on 7.2 Designer and just before leaving for the day yesterday I tried the 2nd option you noted in your post. Only, I only have (0) as the argument for the “go” method. It does, indeed, do what I want. Now, if I understood what the other arguments (-1, null) actually mean, I’ll make use of them.

Thanks again for your reply!

The second argument is the number of rows that can be displayed and the third one, optional, sorting info.
You can find the exact description in the docu (for version 8.0 you can find it here http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuite8_ga/My_webMethods_and_Task_Engine/8-0-SP1_CAF_JavaScript_Reference/index.html

best regards
Javier