![](/img/trans.png)
[英]How to add Edit and delete button in each row using javascript/jquery
[英]Is there any way to add edit/delete button in each row for DHTMLX grid?
我正在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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.