Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bediehau
Partner - Contributor III
Partner - Contributor III

Widget - doReload() - how to get feedback on completion/success/failure?

I have created a widget to reload data in my app.

It is very simple, based on the sample code snippet for a reload button.

I have had to create e security rule that gives read and update authority to users on the app and app objects where this widget is to be used, and I have had to give these users read authority to the data connection that is used in the app.
This works fine in both desktop and server.
I use expression =ReloadTime() in the title of the widget to see when it changes.

Unfortunately, the sample code snippet from the widget editor does not give any feedback about success or failure of the data load.

After some fidling, I managed to let it show an animated gif with an hourglass.

This is what the widget code looks like (I replaced the anigif with a sync lui icon in the span):

<lui-button
      ng-click="app.doReload();ShowIcon=1;"  // this is the code executed on click
      ng-init="ShowIcon=0">                                     // this is the initialisation of the variable
     Reload App                                                              // this is the caption on the button
    <span class="lui-icon lui-icon--sync"            // followed by an icon that is initially hidden
          aria-hidden="true"
          ng-show="ShowIcon">                                  // this controls the visibility of the icon based on the variable
     </span>
</lui-button>

The button does not get redrawn when the data load is complete, so the data changes (or it doesn't if nothing has changed) but the hourglass gif does not disappear.

I have tried to do sth like app.doReload().then(ShowIcon=0) or  app.doReload().then( function() {ShowIcon=0}) or app.doReload().then((result) ShowIcon=0) and many variations but that just doesn't work at all. the reload no longer gets executed and obviously also no feedback.

Is there a way that I can have feedback (callback? then? ...?) on the doReload in a widget?

Labels (4)
0 Replies