gpt4 book ai didi

javascript - 有没有办法在 DHTMLX 网格的每一行中添加编辑/删除按钮?

转载 作者:太空宇宙 更新时间:2023-11-03 18:06:34 25 4
gpt4 key购买 nike

我正在处理 DHTMLX 网格,我需要在每一行中添加编辑/删除按钮,有什么办法可以做到吗?我用谷歌搜索,找到了复选框和链接。

任何帮助将不胜感激。

最佳答案

您可以使用任何需要的 html 内容创建自定义列类型。例如,以下代码将创建一个 eXcell,它将单元格值呈现为带有标签的按钮:

   function eXcell_button(cell){ //the eXcell name is defined here
if (cell){ // the default pattern, just copy it
this.cell = cell;
this.grid = this.cell.parentNode.grid;
}
this.edit = function(){} //read-only cell doesn't have edit method
this.isDisabled = function(){ return true; } // the cell is read-only, so it's always in the disabled state
this.setValue=function(val){
this.setCValue("<input type='button' value='"+val+"'>",val);
}
}
eXcell_button.prototype = new eXcell; // nests all other methods from the base class

之后您需要做的就是在您的网格中设置您的列类型:

grid.setColTypes("button,...");

在这里您可以找到包含各种示例的详细教程: http://docs.dhtmlx.com/grid__columns_types.html#customeditors

关于javascript - 有没有办法在 DHTMLX 网格的每一行中添加编辑/删除按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24533473/

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