1
只有滿足特定的條件(例如該行有特定值的字段),纔有可能在Kendo UI網格中使用行模板?如果沒有滿足這個條件,那麼它不應該渲染模板,而只是正常渲染行。有條件的模板kendo ui
我不想在模板本身內指定條件,因爲除非我弄錯了,否則如果條件不滿足,我還必須在模板定義中包含「默認」html。
這是我試圖實現的一個例子,它不起作用。爲了簡潔我省略了不相關的我的問題其他網格屬性:
$("#divGrid").kendoGrid({
rowTemplate: function (data) {
if (condition) kendo.template($("#myRowTemplate").html(data));
// else render row without the template, but how?
}
});
這是不幸的,但感謝您的回覆,並解決了缺少參數的問題。標記爲正確的答案。 – aw1975