I have been trying to use if and else in a template of one of the field in kendoGrid.I have two fields "StatusDesc" and "newStatusDesc". I want show one of the value as an anchor tag. That is displaying fine but if you notice onclick defined for anchor tag,it has one of the field from the grid itself because it has to open a another page but when i click on the anchor tag, console of my browser shows:
uncaught ReferenceError: WEW6101 is not defined
Actually if I check firebug, it shows below value set to my anchor tag parameter which is correct but I am not able to call the function "WEW6101"
onclick='openStatusReload(WEW6101)
$("#Grid").kendoGrid({
dataSource: TUEDataSource,
autoBind: false,
scrollable: false,
sortable: {
allowUnsort: false
},
//filterable: { mode: "row", style: "max-width:100px;" },
//groupable: true,
pageable: {
refresh: true,
buttonCount: 5,
pageSizes: 5
},
dataBound: gridDataBound,
columns:
[
{ field: "newStatusDesc", hidden: true },
{ field: "StatusDate", title: "Status Date", width: 200, format: "{0:MM/dd/yyyy}", filterable: { cell: { showOperators: false, suggestionOperator: "contains" } } },
{ field: "Status", title: "Status", width: 150, filterable: { cell: { showOperators: true } } },
{ field: "LimitedDate", title: "Expiration Date", format: "{0:MM/dd/yyyy}", width: 150, filterable: { cell: { showOperators: true } } },
{
field: "StatusDesc", title: "Comments", width: 150,
template: "#if(StatusDesc == '' && newStatusDesc!='' && newStatusDesc!= null ) {#<a href='javascript:void(0)' class='margin-right10' onclick='openStatusReload(#=newStatusDesc#)'> #:newStatusDesc#</a>#} else{##:StatusDesc##}#", filterable: { cell: { showOperators: true } }
// template: "<a href='javascript:void(0)' class='margin-right10' onclick='openPlayerTUEStatusReload(#=Tue_StatusDesc#)'>#=TueStatusDesc#</a>", filterable: { cell: { showOperators: true } }
},
]
});