Angular ui-grid events in cell header not firing

Scott picture Scott · Oct 29, 2014 · Viewed 17.8k times · Source

I'm using a headerCellTemplate in the columDefs of my ui-grid (not ng-grid but the new rewrite). In the html I have a checkbox. Essentially I am trying to add a checkbox in the header of a column that is all checkboxes so I can check all/none. The cell renders fine with the checkbox. The problem is that the ng-change in the checkbox in the header never fires the event. Additionally the ng-model value never changes. Looking at the code there is a directive used called uiGridHeaderCell so I have to assume that it is gobbling up my event as well as being in its own scope so it never sets the variable in my scope.

Any way around this? Every example I've come across never has anyone trying to call their own method from within the header (ie calling something outside the scope of the directive).

Answer

Marcus Showalter picture Marcus Showalter · Nov 19, 2015

External-Scopes is no longer used as of ~3.0.7 Accessing Scope in templates

Now you add grid.appScope like this in your cellTemplate:

ng-click="grid.appScope.myFunction()"