以下带有下拉菜单的剑道网格。下拉AccountCode项采用对象形式,如下所示;
以下用于显示详细信息;
function loadGrid() {
$("#grdItems").kendoGrid({
dataSource: itemDS,
pageable: {
refresh: false,
pageSizes: false
},
aggregate: [{ field: "Amount", aggregate: "sum" }],
columns: [ {
field: "CostCenter",
title: "Cost Center",
editor: costCenterDropDownEditor,
template: "#:CostCenter.Description#"
}, {
field: "AccountCode",
title: "Account Code",
editor: accountDropDownEditor,
template: "#AccountCode.AccountDescription#"
}, {
field: "Description",
}, {
field: "BillNumber",
title: "Bill Number",
},
{
field: "Amount",
format: "{0:n}",
footerTemplate: "Sum: #= kendo.toString(sum, 'n')#"
},
{ command: [{ name: "edit", text: "MODIFY" }], title: " ", width: "120px" }],
editable: "popup"
});
}
显示时看起来像这样;
当下拉对象为空(如第一张图片所示)时,如何插入占位符?尝试了通常的占位符标记,但它似乎不起作用。
编辑:添加代码
最佳答案
我很确定这些字符串只是 JavaScript 代码。
"#:CostCenter.Description.length > 0 ? CostCenter.Description : 'placeholder'#"
关于javascript - 如果 Kendo UI 中的值为 null,则设置占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31961891/