We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

from "text / x-jsrender" script, how I can send a function defined within the angular range, not a function outside but within a defined angular

from "text / x-jsrender" script, how I can send a function defined within the angular range, not a function outside but within a defined angular

Attachment: Sync_575cbd70.7z

1 Reply

JS Jonesherine Stephen Syncfusion Team November 1, 2016 05:34 PM UTC

Hi Daniel, 
We need to use the type="text/ng-template" script to render the TreeGrid template using angularJS. We have prepared the work around and rendered the custom column in TreeGrid by using “columnTemplate” property. And also rendered the button in a custom field using template and bind the event for button click action. 
Please find the code example below: 
<script type="text/ng-template" id="columnTemplate"> 
        <div> 
            <button ng-click="$parent.clickme()" style="margin-left:5px">Click</button> 
        </div> 
    </script> 
<script> 
var columns = [     ///                      
    { field: "customfield", headerText: "Custom Field", isTemplateColumn: true, angularTemplate: "#columnTemplate" }, ] 
.controller('TreeGridCtrl', function ($scope) { 
            $scope.columns = columns; 
            //inline function for button click event 
            $scope.clickme = function () { 
                alert("We can customize the actions here") 
            } 
        }); 
</script> 
 
Please find the sample from below location. 
 
Regards, 
Jone sherine P S 


Loader.
Live Chat Icon For mobile
Up arrow icon