gpt4 book ai didi

javascript - Kendo UI 下拉列表已选中

转载 作者:行者123 更新时间:2023-12-01 01:21:25 26 4
gpt4 key购买 nike

我有一个 kendo ui 函数下拉列表,它将在网格列编辑器中调用。我的问题,默认情况下如何在编辑功能中添加新记录时显示“”。目前添加新记录时显示为null。

Demo in Dojo

这里我提供了一个工作演示。 谢谢

最佳答案

如果我理解正确的话,您只需在模型中的价格中添加默认值即可?

"Price": {type: "string", defaultValue: "y" }, 

我包含整个函数,以防万一:

$(function() {
$("#grid").kendoGrid({
dataSource: {
data: [
{ Name: "Young John", Price: "y" },
{ Name: "John Doe", Price: "n" },
{ Name: "Old John", Price: "y" }
],
schema: {
model: {
id: "id",
fields: {
"id": { type: "number" },
"Price": {type: "string", defaultValue: "y" },
}
}
}
},
editable: "inline",
toolbar: ["create"],
columns: [{ field: "Name"},
{ field: "Price",
template: "#=(data.Price == 'y' ? 'Yes' : 'No')#",
editor: radioPrice
} ],
edit: function(e) {
if (e.model.isNew()) {
e.model.Price = 'y';
}
}
});
});

关于javascript - Kendo UI 下拉列表已选中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54191929/

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