gpt4 book ai didi

javascript - Kendo ui 添加新记录时禁用列

转载 作者:行者123 更新时间:2023-12-01 01:23:48 24 4
gpt4 key购买 nike

如何实现此目的,我想仅在添加新记录并选中时禁用状态列上的单选按钮。

enter image description here

我不知道我应该给出脚本的哪一部分。但我在这里提供了一些。

我的 KendoGrid 脚本

        $("#grid").kendoGrid({
dataSource: dataSource,
dataBound: setColor,
height:400,
sortable: true,

columns: [
{ field: "segmentActive", title:"STATUS", width: "120px", editor: RadioSegmentActive,
template: data => data.segmentActive == "y" ? "Yes" : "No" }, // <-- displaying Yes/No insted of y/n

{ field: "marketSegmentName", title:"SEGMENT NAME", width: "120px" },

{ field: "publicPrice", title:"PUBLIC PRICE", width: "120px", editor: RadioPublicPrice,
template: data => data.publicPrice == "y" ? "Yes" : "No"},

{ field: "isHouseUse", title:"HOUSE USE", width: "120px", editor: RadioHouseUse,
template: data => data.isHouseUse == "y" ? "Yes" : "No"},

{ command: ["edit",{ name: "destroy", text: "De-active" }], title: "&nbsp;", width: "120px" },
],
editable: "inline",
...........

我的RadioSegmentActive函数

function RadioSegmentActive(container, options) {
var guid = kendo.guid();

$('<input class="k-radio" id="radio3" name="segmentActive" type="radio" value="y" >').appendTo(container);
$('<label class="k-radio-label" for="radio3">YES</label>').appendTo(container); //YES
$('<br>').appendTo(container);
$('<input class="k-radio" id="radio4" name="segmentActive" type="radio" value="n" >').appendTo(container);
$('<label class="k-radio-label" for="radio4">NO</label>').appendTo(container); //NO
}

最佳答案

我不确定“检查是”是什么意思,但您可以通过处理 edit event 来做到这一点网格:

editable: "inline",
edit: function(e) {
if (e.model.isNew()) { // We are adding
// if ($("#radio3").prop("checked")) { // Check some field...
$("#radio3").attr('checked', true); // Set yes radio button
$('input[name=segmentActive]').attr("disabled",true); // Disable radio buttons
// }
}
}

关于javascript - Kendo ui 添加新记录时禁用列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54000404/

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