剑道网格根据列值在列中生成动态html?

问题描述:

我使用剑道网格,其中i有一个要求基于其将由另一function.I被返回的列的值,以产生动态HTML有以下代码剑道网格根据列值在列中生成动态html?

$("#divGenerateLogin_kendogrid").kendoGrid({ 
 
       dataSource: { 
 
        data: data, 
 
        pageSize: 10 
 
       }, 
 
       sortable: true, 
 
       reorderable: true, 
 
       pageable: { 
 
        pageSizes: true, 
 
        buttonCount: 5 
 
       }, 
 
       filterable: true, 
 
       // selectable: true , 
 
       // dataBound: onDataBound, 
 
       columns: [ 
 
        { 
 
         field: "StudentName", 
 
         title: "Student Name", 
 
         type: "string" 
 
        }, 
 
        { 
 
         field: "Class", 
 
         title: "Class", 
 
         type: "string" 
 
        }, 
 
        { 
 
         title: "Login", 
 
         template: "#: LoginColHtml(IsLoginAvilable==1) #" 
 
        } 
 

 
       ] 
 
      }); 
 
      
 
      
 
      
 
function LoginColHtml(isLoginAvilable) { 
 

 
      var html = ""; 
 
      if (isLoginAvilable == true) { 
 
       html = "<button type='button' class='btn-ressetpwd'><i class='fa fa-key'></i> reset password</button>"; 
 
      } else { 
 
       html = "<button type='button' class='btn-generatelogin'><i class='fa fa-user'></i> generate login</button>"; 
 
      } 
 
      // "<div>#: (IsGuardianLoginAvilable==1) #</div>"; 
 
      return html; 
 

 
     }

而不是在列中返回实际的HTML,而是将其作为字符串返回。我怎样才能将实际的HTML添加到列而不是字符串?

FYI enter image description here

我试图与这和它的工作

{ 
 
    title: "Guardian Login", 
 
    template: "#= LoginColHtml(IsLoginAvilable==1) #"  
 
}