gpt4 book ai didi

jquery - 根据某些特定列值启用或禁用 jqgrid 中复选框的选择

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

我有一个 jqgrid,我想在其中选择代理状态列中值为“正在运行”的行。对于其余状态,我应该无法选择该行。

JQGrid 代码

 datatype: "json",
contentType: 'application/json',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
colNames: ['Id', 'Machine Name', 'IP Address', 'Discovered Date', 'Agent Install Status', 'Agent Installation Date', 'Agent Status', 'Agent Version', 'Last HeartBeat Recieved'],
colModel: [
{ name: 'id', hidden: false, width: 15, key: true },
{ name: 'machineName', width: 120 },
{ name: 'ipAddress', width: 60 },
{ name: 'discoveredDate', width: 110, formatter: 'date', formatoptions: { srcformat: 'y-m-d', newformat: 'l, F d, Y' } },
{ name: 'agentInstallStatus', width: 70 },
{ name: 'agentInstallationDate', width: 110, formatter: 'date', formatoptions: { srcformat: 'y-m-d', newformat: 'l, F d, Y' } },
{ name: 'agentStatusName', width: 90 , edittype:'select', editoptions:{value:"Running"} },
{ name: 'agentVersion', width:50},
{ name: 'lastHeartBeatRecieved', width: 110, formatter: 'date', formatoptions: { srcformat: 'y-m-d', newformat: 'l, F d, Y' } }
],
sortname: 'id',
sortorder: 'asc',
loadonce: true,
viewrecords: true,
gridview: true,
width: gwdth,
height: 650,
rowNum: 10,
rowList: [10, 20, 30],
mtype: 'GET',
multiselect: true,
multipleSearch: true,
pager: "#jqGridPager"
});

enter image description here

是否可以只显示运行状态的复选框?

我对这个环境完全陌生。

最佳答案

我看到有两个主要选项可以实现您的要求:

  • 使用 rowatr 回调根据 “agentStatusName” 列的内容禁用行。请参阅the demothe answer 创建.
  • 使用 beforeSelectRow 回调(以及 onSelectAll)来防止根据 “agentStatusName” 列的内容选择行。

第一个选择是最简单和安全的。第二种更灵活。人们可以允许编辑行(如果需要),但仍然阻止选择。

关于jquery - 根据某些特定列值启用或禁用 jqgrid 中复选框的选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33821572/

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