1

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

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.