gpt4 book ai didi

javascript - 如果 Kendo UI 中的值为 null,则设置占位符

转载 作者:行者123 更新时间:2023-12-03 09:15:34 24 4
gpt4 key购买 nike

以下带有下拉菜单的剑道网格。下拉AccountCode项采用对象形式,如下所示;

enter image description here

以下用于显示详细信息;

    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"
});
}

显示时看起来像这样;

enter image description here

当下拉对象为空(如第一张图片所示)时,如何插入占位符?尝试了通常的占位符标记,但它似乎不起作用。

编辑:添加代码

最佳答案

我很确定这些字符串只是 JavaScript 代码。

"#:CostCenter.Description.length > 0 ? CostCenter.Description : 'placeholder'#"

关于javascript - 如果 Kendo UI 中的值为 null,则设置占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31961891/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com