BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hi Rob,
Thanks for contacting Syncfusion support.
We have achieved your requirement “Bind the ng-click event for the template column” by render the template column with script type “text/ng-template”. Please refer to the below code example.
<script type="text/ng-tempalte" id="actionTemplate"> <span id='exportIntegratorTemplate' ng-click='$parent.export()' style='color:{{data.Color}};cursor: pointer;'>{{data.Color}}</span> </script> |
We have prepared the simple sample using JS playground
http://jsplayground.syncfusion.com/rqaknwgc
Regards,
Saravanan A.
Hi Rob,
If we rendered the same template for both parent and detail Grid’s column, we can’t call the parent Grid’s scope method ($scope.export) while click on the template column of details grid.
So, we suggest you to use the separate template for both Grid and detail Grid control and refer to the below code example.
angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope) {
. . . //Columns for Details Grid $scope.col1 = [ . . . { "headerText": "Ng click1", "template": "true", "templateID": "#actionTemplate1", "textAlign": "right", "width": 90 }]; //Columns for Parent Grid $scope.col = [ { "field": "Color", "textAlign": "right", "width": 90 }, { field: "targetNumber", headerText: "TargetNumber", width: 100 }, { field: "targetType", headerText: "TargetType", width: 100 }, { "headerText": "Ng click", "template": "true", "templateID": "#actionTemplate", "textAlign": "right", "width": 90 }] });
<!--Template for parent--> <script type="text/ng-template" id="actionTemplate"> <span id='exportIntegratorTemplate' ng-click='$parent.export()' ng-style="{'color':data.Color, 'cursor': 'pointer'}">{{data.Color}}</span> </script> <!--Template for child--> <script type="text/ng-template" id="actionTemplate1"> <span id='exportIntegratorTemplate' ng-click='$parent.$parent.export()' ng-style="{'color':data.Color, 'cursor': 'pointer'}">{{data.Color}}</span> </script> |
And we have rendered the detail template Grid using the script type ng-template and refresh the template using the “detailsDataBound” event of Grid control. Please refer to the below code example.
<script id="detailsTemplate" type="text/ng-template"> <div id="grid1" ej-grid e-datasource="$parent.data" e-columns="$parent.col1"> </div> </script> $scope.detailgrid = function (e) { this._trigger("refresh"); }; |
We have created the sample in JS playground.
http://jsplayground.syncfusion.com/mpprbv2o
Regards,
Saravanan A.
Hi Rob,
We analyzed your sample in which you have changed $scope.getData dynamically based on the detail grid and then while clicking on the template column of detail Grid, all the details Grid’s will be refreshed with the recently updated datasource by $scope.getData on angular context which may be the cause of issue.
So, we suggest you to delete scope of the $scope.getData in export method and refer to the below code example.
angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope, $timeout) {
$scope.export = function (color) { alert("Color is : " + color); delete $scope.getData; }; }); |
We have modified your sample and refer the below link.
http://jsplayground.syncfusion.com/ovmeamv2
Regards,
Saravanan A.
Hi Rob,
We analyzed your sample in which you have changed $scope.getData dynamically based on the detail grid and then while clicking on the template column of detail Grid, all the details Grid’s will be refreshed with the recently updated datasource by $scope.getData on angular context which may be the cause of issue.
So, we suggest you to delete scope of the $scope.getData in export method and refer to the below code example.
angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope, $timeout) {
$scope.export = function (color) { alert("Color is : " + color); delete $scope.getData; }; }); |
We have modified your sample and refer the below link.
http://jsplayground.syncfusion.com/ovmeamv2
Regards,
Saravanan A.