This is a migrated thread and some comments may be shown as answers.

AngularJS Function to HTML

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 11 Oct 2016, 03:07 PM

I am trying to create a function that changes the awesome icon before the test based on what the text is.

I can't get it to read the html from the return. I have attach an image of what I am trying to create.

field: "ProductName", title: "Status", template: " {{ setStatus(dataItem.ProductName) }} #=ProductName# "

 

 $scope.setStatus = function(name) {            
            if (name === 'Chai') {
                return "<i class='fa fa-check-circle' style='color:green; font-size: 150%'></i>";
            }
            else if (name === 'Chang') {
                return "<i class='fa fa-times-circle' style='color:red; font-size: 150%'></i>";
            }            
        }

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 13 Oct 2016, 07:11 AM
Hello Danny,

I can assume that the issue is caused by the used format of the template and the called function inside it.

Please check more information for the columns.template of the Kendo UI Grid:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.template

Additionally, I made a Dojo example based on provided code and it is working as expected:

http://dojo.telerik.com/EYagA

I hope this is helpful.

Regards,
Stefan
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Danny
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or