Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional in Kendo grid column template

I need to apply a condition in my kendo grid column template.

Here is my code:

columns: [
{
    field: "EmpName",
    title: "Name",
    template: '<a href="\\#" onclick="showName();">#= if (empName == null){ "show xxx"
               } else {
                   // I want to show actual name if it is not null
                   empName
               } #</a>'
},
like image 856
jestges Avatar asked Sep 11 '13 11:09

jestges


2 Answers

Check this

'<a href="" onclick="showName();">'# if( empName==null) {#<span>show xxx<span># } else {#<span>#: empName#<span>#} #'</a>'
like image 165
Abbas Galiyakotwala Avatar answered Nov 14 '22 19:11

Abbas Galiyakotwala


something like this should work for you:

# if(test == null) { #
    <span style="border:1px solid red"></span>
# } else { #
    <span style="border:1px solid lime"></span>
# } #

Don´t know how to do inline at the moment.

like image 4
chris Avatar answered Nov 14 '22 21:11

chris