access scope from ag-grid cell template

335 views Asked by At

How to trigger a angular js function (ng-blur) from ag-grid cell template?

Below is my column definition for ag-grid

var columnDefs = [
          {headerName: "Make", field: "make" , template:'<input type="text" class="form-control control-width-90 margin-left-5" ng-blur="alert(\'wewew\')"/>'},
          {headerName: "Model", field: "model"},
          {headerName: "Price", field: "price"}
        ];

Data for ag-grid

var rowData = [
          {make: "Toyota", model: "Celica", price: 35000},
          {make: "Ford", model: "Mondeo", price: 32000},
          {make: "Porsche", model: "Boxter", price: 72000}
        ];

Grid Options

$scope.gridOptions = {
              columnDefs: columnDefs,
              rowData: rowData
};

Output [PFA for the output][1] [1]: https://i.stack.imgur.com/WEttX.png

Based on the column definition I am able to render the template but unable to trigger the event on blur. Can anyone suggest me how to trigger the event from custom template or access scope from ag-grid custom template? Thanks in Advance!

1

There are 1 answers

2
Sandeep Verma On

Do you want to trigger event on cell value change ? Then you can use (cellValueChanged) event of ag grid.