Kendo ui grid if else condition

后端 未结 5 1255
春和景丽
春和景丽 2020-12-15 10:35

What is wrong with my code?

I have to check in kendo UI grid is there \"OrderType 20\" in my column. If it is, I need to apply my css condition which includes back

5条回答
  •  余生分开走
    2020-12-15 11:24

    I would recommend you to write a function and call that in template and code the logic in that. following is the example.

    $(gridId).kendoGrid({
    dataSource: {
        data: datasource
    },
    scrollable: true,
    sortable: true,
    resizable: true,
    columns: [
     { field: "MetricName", title: "Metric", width: "130px" },
     { field: "OnTrack", title: "On Track", template:'#:changeTemplate(OnTrack)#', width: "130px", attributes: { style: "text-align: center !important;" } },
     { field: "CurrentAmount", title: "Current", template: '$ #:parseFloat(CurrentAmount).toFixed(2)#', width: "130px" },
     { field: "RequiredAmount", title: "Required", template: '$ #:parseFloat(RequiredAmount).toFixed(2)#', width: "130px" }
    ]
    });
    
    function changeTemplate(value)
    {
       Conditions depending on Your Business Logic
    if ()
        return "HTML Here";
    else
        return "HTML Here";
    }
    

提交回复
热议问题