2

I'm trying to fire a click event when a cell in ui-grid is clicked but the ng-click isn't working. Also ng-class isn't working and I can't get width: '*' to work. Does anyone know of any accurate documentation for angular-ui-grid? I'm using angular v 1.5.11 and angular-ui-grid v 4.2.3. It seems like half the features of ui-grid don't work and the docs don't seem to explain why.

{ name: 'Number of Vendor Parts', field: 'xrefCount', enableFiltering: false,
      cellTemplate: '<div ng-class="{inactive: row.entity.active === \'N\'}" ' +
                         'ng-click="grid.appScope.showCrossReference()">' +
                      '<a>{{ row.entity.xrefCount }}</a>' +
                    '</div>'
    }

1 Answer 1

0

Take a look at this plunker. I think your problem is that you have not added you controller after grid.appScope. If you declare you controller like this:

ng-controller="MainCtrl as main"

The expression for ng-click should look like this:

grid.appScope.main.showCrossReference(grid, row)

Note that you can pass to the function the grid and the row of the clicked button.

As you can see in the plunker for ng-class I use a function which returns the name of the css class using the row parameter.

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.