gpt4 book ai didi

javascript - 如何限制对数据表行的选择?

转载 作者:行者123 更新时间:2023-11-27 23:21:13 25 4
gpt4 key购买 nike

我想禁用数据表行。在这种情况下,我看到两个必需的步骤:

  • 设置CSS
  • 防止选择

我已经使用相应的 Webix 方法成功完成了第一步:

function disableRow(table, row){
table.addRowCss(row, "disabled-row")
};

webix.ui({
view:"datatable",
id:"mytest",
...
});

disableRow($$("mytest"), 2)

http://webix.com/snippet/e47b4257

但是如何限制这一行的选择呢?谢谢

最佳答案

我找到了您要找的答案here

There's no disabled property for rows, but you can use onBeforeSelect and onBeforeEditStart events to prevent related actions on the particular row:

有一个链接到 this上面链接页面上的代码片段可以满足您的需求。

webix.ui({
view:"datatable", autoConfig:true, editable:true, data:grid_data,
on:{
onBeforeEditStart:function(id){
if (id.row == 2 ) return false
},
onBeforeSelect:function(id){
if (id.row == 2 ) return false
}
}
});

关于javascript - 如何限制对数据表行的选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40979242/

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