How to refresh a widget

1
0
-1

Hi,

I have a process built in Bonita 7.1.2. and I've made a summary page for all the active cases. I use some widgets as a Data Table, texts, etc.

My question is, how can I put a button or something that refreshes the data on the summary page? I don't want implement a method that refreshes the window, I only want to refresh the Data Table.

Thanks in advance.

David.

1 answer

1
+1
-1

I think you can simply add the button and set the followings:
action = POST (corrected)
url = the URL to your case list (should the the url where you load your data table)
Data to Send = empty variable
Successful value = the bind variable of your data table

If you need auto refresh, you may need to create custom widget which uses a setTimeout script to call http request periodically.
Something like (not tested, please do the debug yourself :):
function doPeriodicRequest(httpAction, url){
$http({method:httpAction,url:url})
.success(function (response){
$scope.properties.dataOnSuccess = response;
}).error(function (response){
$scope.properties.dataOnFailed = response;
});
setTimeout(doPeriodicRequest(httpAction, url),$scope.properties.period);
}
setTimeout( doPeriodicRequest($scope.properties.action, $scope.properties.url), $scope.properties.period);

Comments

Submitted by dbravo on Thu, 11/05/2015 - 14:56

Hi.

Thanks for your answer, I've tried it but the button widget does not have a GET action. :(

Submitted by johnny_104 on Fri, 11/06/2015 - 03:44

sorry, I was wrong about that, POST should also work, just return an empty variable in the data sent on click. I used this trick to load dynamic table on click.

Submitted by dbravo on Mon, 11/09/2015 - 20:09

Hi.

Well, I've tried it, but the POST method to get data does not work with BDM. I always get this:

"code":405,"contactEmail":null,"description":"The method specified in the request is not allowed for the resource identified by the request URI","homeRef":"/","reasonPhrase":"Method Not Allowed","uri":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6"

Thanks for your answer.

Submitted by johnny_104 on Wed, 11/11/2015 - 09:43

Sorry, I got the same problem switching to POST. I have created a custom widget to handle the refresh.
Basically you can copy the pbButton.js logic from workspace/default/web_widgets/pbButton/ folder. Add one more option to the action list for GET. Then you can refresh as you press the button.

As for auto-refresh, I found setTimeout() may cause dead loop in Angular. Use $interval to callback the doRequestDelayed function to reload the content.

Notifications