Disable SUBNM component


#1

Hi,

Is it possible to disable a SUBNM component? I could not find an attribute to do this and I my case I would like to disable a SUBNM (displayed as a dropdown) so the user cannot change the value.
I was able to get it halfway done via a $watch and some jQuery code:

$scope.$watch('page.hasDate', function(newValue, oldValue) {
        if (newValue != undefined && !newValue) {
          $("#dateColumn .tm1-ui-subnm").attr("disabled", true);
        } else if (newValue != undefined && newValue) {
          $("#dateColumn .tm1-ui-subnm").attr("disabled", false);
        }
    });

This prevents the user from entering/searching elements in the dropdown, but does not prevent the user from clicking the carret and selecting an element.

Any suggesstions on how to tackle this issue?

Cheers,
Fabian


#2

Hi @fabian.kueng,

Why not just show a label instead? So something like:

<tm1-ui-subnm ng-if="!page.hasDate" ...></tm1-ui-subnm>
<span ng-if="page.hasDate">{{model.here}}</span>

You can then put any styles into the value/span that you like to show.


Paul


#3

Hi @plim,

Thanks for the suggestion, will give it a try!

Cheers,
Fabian