javascriptangularundefinedangular-ui-gridui-grid

Undefined error when passing row.entity and col.field to function


I need row.entity and col.field to determine if a button needs to be disabled or not, so here's the code for the cellTemplate of my UI-grid

      cellTemplate:
     '<div *ngIf="{{COL_FIELD}}"> '+
        '<div class="ui-grid-cell-contents" > {{COL_FIELD}}' +
           '<button  uib-tooltip="Modifica" tooltip-placement="auto" ng-disabled="grid.appScope.modificaDisabled(row.entity, col.field)"'+
               'rel= "{{row.entity}}" rol="{{col.field}}" '+
               'class="btn btn-xs btn-primary stretto" style="float:right;" edit>'+
               '<i class="fa fa-pencil fa-fw"></i>'+
           '</button>'+
        '</div>'+
     '</div>'

and here's the function called

var modificaDisabled = function(riga,col){
        console.log(riga)
        console.log(col)
        //disabling logic
        }

The problem ( sgrid.appScope.modificaDisabled(row.entity, col.field) ) is that the second parameter passed (in this case col.field) results undefined but if i switch their position (col.field, row.entity ) col.field is actually defined but then row.entity results undefined.

Can anyone help me? I've seen another post talking about the spacing after the comma, but nothing seems to work


Solution

  • I eventually found a "solution" :

    ng-disabled="grid.appScope.modificaDisabled([row.entity, col.field])"
    

    by passing the values as an array I get them defined (idk why) and i can finally proceed