How to re-render DBR to change tm1-decimals attribute (is not watched)?

Hi Canvas fans,

do you by chance have any approach how I could force a DBR to be rendered newly without reloading the complete page?

My use case is a scale selection in the page header (M, k, 1). Depending on the selection, the figures in DBR should show different number of decimals. However, as tm1-data-decimal is not watched, how can I achieve this? There are other attributes being watched, so why not this one? Is there a way to call whatever method to force the DBR to be rendered again? Just the same that happens if you e.g. change the tm1-data-scale option (which is being watched according to documentation).

Any suggestions welcome.

Andreas

@andreas.franke

Have you considered tm1-refresh-group?

That way you can refresh a set of single DBR statements, or a single DBR, instead of them all.

That’s if I understand what you are trying to do correctly.

Jack

Hi Jack,

thanks, I’ve read the threads on refreshing the data using tm1UI.dataRefresh() with or without a refresh group. However, this is not my issue, because it will refresh the data shown in the DBR, which works fine, but it shows them the same way as before, i.e. a changed attribute value for tm1-data-decimal is not considered here, and consequently, the number of decimals shown in the browser remains the same.

One ugly workaround is to fire a “$scope.$state.reload()” call. But this will render the complete page and I will loose the current navigation state (e.g. expanded/collapsed data). On top, it takes a few seconds to re-render the complete page again including all input DBRs.

My recommendation/request would be to make tm1-data-scale watched, just like it is for tm1-data-scale. A cherry on the cake would be, if you also make tm1-override-accounting watching, as this would give the total flexibility.

Additional information: I’m talking about input DBRs. If I was just talking about read-only DBRs, I would be using ng-model and output the value using {{myformatfunction(mymodel)}} and apply some formatting this way. But as I need inputs, this is not an option.

Andreas

Hi @andreas.franke,

Adding more watchers for each of these attributes can have overheads in loading. An alternative would be to add an ng-if into the DBR themselves or any other components you can group - and to force re-creation of these selected components in a few milliseconds.

An example would be, with Select and DBR in HTML,

<select ng-change="decimalChanged();" ng-model="selections.decimal" ...></select>
<tm1-ui-dbr ng-if="values.display" tm1-data-decimal="{{selections.decimal}}" ...></tm1-ui-dbr>
<tm1-ui-dbr ng-if="values.display" tm1-data-decimal="{{selections.decimal}}" ...></tm1-ui-dbr>

And in your page’s controller,

$scope.decimalChanged = function(){
  $scope.values.display = false;
  $timeout(function(){
    $scope.values.display = true;
  }, 100);
};

That way you can control which components can trigger the refresh of the DBRs or another other components via a single function and as little watchers as possible without reloading the page.

You can also add mask them too with some animations while re-rendering the components if you would prefer to hide this action from the users.


Cheers,
Paul